Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26366

RE: why the different output in Eclipse and Python Shell?

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'output': 0.04; 'subject:Python': 0.05; 'none,': 0.05; 'assign': 0.07; 'completeness': 0.07; 'expressions': 0.07; 'python': 0.09; 'dict': 0.09; 'received:155': 0.09; 'repr': 0.09; 'created.': 0.16; 'debugger,': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'is",': 0.16; 'received:155.180': 0.16; 'received:155.180.234': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:169.70.184': 0.16; 'received:169.70.184.72': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:hubcr105.exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'repr()': 0.16; 'securities,': 0.16; 'shell:': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'shell': 0.18; 'to:name:python-list@python.org': 0.20; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; 'accuracy': 0.27; 'dictionary': 0.29; 'prints': 0.29; 'received:169': 0.29; 'header:Received:8': 0.30; 'code': 0.31; 'print': 0.32; 'like:': 0.33; 'to:addr:python-list': 0.33; 'subject:?': 0.35; 'something': 0.35; 'really': 0.36; 'but': 0.36; 'charset:us-ascii': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'mean': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'anywhere.': 0.84; 'received:169.254.8': 0.84
X-DKIM OpenDKIM Filter v2.1.3 sz2.jpmchase.com q71FR1n6012303
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1343834821; bh=cYPQTZ6iS+WRwmI5Oz5XALgLIwIHWz6ZsLNV0kY5xuE=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=JNOE1QxUabNSg/4uN7et2YkJbhV/raptVhNpyAcBYtxHPG9qqJweQSupr0uGIXo6O ZG4qhyxoEhgiOQX3IhgagM4beRQrTplkxFS/BGZACDzMc23PzSjzf5F6Psdl0qxJip N+wS4Yw5XZasqjMql0/4OaHx1ckte3ZQZfSBBhSY=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: why the different output in Eclipse and Python Shell?
Thread-Topic why the different output in Eclipse and Python Shell?
Thread-Index AQHNb6B9C2Er9lrCNEqqsDXIzZhy75dE/siAgAAUkLA=
Date Wed, 1 Aug 2012 15:26:40 +0000
References <CAEMsKDuUV9K0r3da2rvZVenMdFMvePSbHoK5NAa-t6gkBgQzQg@mail.gmail.com> <5018FFEF.3000203@davea.name>
In-Reply-To <5018FFEF.3000203@davea.name>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.47]
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-DLP-FWD Yes
Content-Type text/plain; charset="us-ascii"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2834.1343834830.4697.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343834830 news.xs4all.nl 6870 [2001:888:2000:d::a6]:37907
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26366

Show key headers only | View raw


> > my code in Eclipse:
> >
> > dict.fromkeys(['China','America'])
> > print "dict is",dict
> >
> > output: dict is <type 'dict'>
> >
> > my code in Python Shell:
> >
> > dict.fromkeys(['China','America'])
> >
> > output:{'America': None, 'China': None}
> >
> > Output in Python Shell is what i wanna,but why not in Eclipse?
> >
> >
> 
> The Python Shell is an interactive debugger, and prints the repr() of
> expressions that you don't assign anywhere.  I don't know Eclipse, but I
> suspect what you want to do is something like:
> 
> print "dict is", repr(dict)

I think you mean
print "dict is", repr(dict.fromkeys(['China','America']))

Otherwise you are just printing the repr of the dict type
and not the dictionary created. I would really store the output and
then print it.

d = dict.fromkeys(['China','America'])
print "dict is", d

Ramit

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: why the different output in Eclipse and Python Shell? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-08-01 15:26 +0000

csiph-web