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


Groups > comp.lang.python > #81987

Re: dict turn to list at runtime unexpected!!!

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!news.astraweb.com!border2.a.newsrouter.astraweb.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'true)': 0.09; 'def': 0.12; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'thanks,': 0.17; 'print': 0.22; 'header:User-Agent:1': 0.23; 'appreciated': 0.26; 'header:X-Complaints-To:1': 0.27; 'statement': 0.30; 'subject:list': 0.30; 'gives': 0.31; 'code': 0.31; 'writes:': 0.31; 'run': 0.32; 'skip:s 30': 0.35; 'charset :us-ascii': 0.36; "i'll": 0.36; 'list.': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'received:217': 0.63; 'email addr:gmail.com': 0.63; 'reverse': 0.68; 'subject:!!!': 0.74
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: dict turn to list at runtime unexpected!!!
Date Fri, 05 Dec 2014 08:42:53 +0100
References <e5012cb1-1820-4380-8e84-e8620481cc42@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e0b085.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:6fWWSt/KUikLWM8qgdPCGH5vBjU=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16614.1417765507.18130.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1417765507 news.xs4all.nl 2857 [2001:888:2000:d::a6]:45655
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 2907
X-Received-Body-CRC 1070332708
Xref csiph.com comp.lang.python:81987

Show key headers only | View raw


telnetgmike@gmail.com writes:

> Why the following code gives me errors??? And why the print statement run 2 times? I'll be appreciated your helps, thanks,
> addrnum_dict = {'a':1,'b':2}
> def orderaddrtimes():
>     global addrnum_dict
>     print type(addrnum_dict)
>
>     addrnum_dict = sorted(addrnum_dict.iteritems(), key=lambda d:d[1], reverse = True)

"sorted" returns a list.

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


Thread

dict turn to list at runtime unexpected!!! telnetgmike@gmail.com - 2014-12-04 22:56 -0800
  Re: dict turn to list at runtime unexpected!!! telnetgmike@gmail.com - 2014-12-04 23:37 -0800
  Re: dict turn to list at runtime unexpected!!! dieter <dieter@handshake.de> - 2014-12-05 08:42 +0100
  Re: dict turn to list at runtime unexpected!!! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-12-05 12:43 -0500

csiph-web