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!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 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; 'repr': 0.09; 'cc:addr:python-list': 0.10; 'itself.': 0.11; 'created.': 0.16; 'debugger,': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'is",': 0.16; 'repr()': 0.16; 'securities,': 0.16; 'shell:': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; 'shell': 0.18; '>>>': 0.18; 'meant': 0.21; 'cc:2**0': 0.23; 'to:2**1': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'right.': 0.27; 'accuracy': 0.27; 'dictionary': 0.29; 'prints': 0.29; 'class': 0.29; 'code': 0.31; 'print': 0.32; 'like:': 0.33; 'subject:?': 0.35; 'something': 0.35; 'really': 0.36; 'but': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'mean': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'sale': 0.76; 'absolutely': 0.84; 'anywhere.': 0.84; 'dict,': 0.84 Date: Wed, 01 Aug 2012 14:42:16 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: "Prasad, Ramit" Subject: Re: why the different output in Eclipse and Python Shell? References: <5018FFEF.3000203@davea.name> <5B80DD153D7D744689F57F4FB69AF4741659B48C@SCACMX008.exchad.jpmchase.net> In-Reply-To: <5B80DD153D7D744689F57F4FB69AF4741659B48C@SCACMX008.exchad.jpmchase.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:eQpjXREuQ3z8R8K+BmNvi15/UfmIhZM1F+axEm/IRRA l8n2RkKsAQtpiDy5C1tRrugMLx/iyN7YCF0bl/4dmG/v71CEO5 1+Et8shP3PEKqJaxaqdMukfHWOf7QI2tcPWICiZ7Mux2q+0SpS +5zgQLIvaSmI8u/UsbAz9dCucwgZdFDhM0AaCLhy0nlI36ejc2 3sdAqeqgf2tKbA8jgSiBUzxJBkYlxWBQQxItvtIYBorB1REsWR iQ+xjixH+3yGUrgitIThGhSTkzhlwsvacAvYS138RiCBwD/KWv vjEs39Jf/cg4QanHYJ6A7eLbzTaNuUnK/n+AG/kJ+Wy2UNLbcW dkYK0nEXmY+Dc8ooVg1o= Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: davea@dejaviewphoto.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343846569 news.xs4all.nl 6941 [2001:888:2000:d::a6]:37107 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26376 On 08/01/2012 11:26 AM, Prasad, Ramit wrote: >>> my code in Eclipse: >>> >>> dict.fromkeys(['China','America']) >>> print "dict is",dict >>> >>> output: dict is >>> >>> 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. Absolutely right. I meant to refer to the name bound to the dict, not the dict class itself.