[Tutor] Another __builtins__.__dict__ question

Gonçalo Rodrigues op73418@mail.telepac.pt
Mon Dec 9 21:39:12 2002


The method sort() sorts a list *inplace*, returning None. You want

temp = __builtins__.__dict__.keys()
temp.sort()

and now temp references the sorted list.

All the best,
G. Rodrigues

----- Original Message ----- 
From: "Poor Yorick" <gp@pooryorick.com>
To: <tutor@python.org>
Sent: Tuesday, December 10, 2002 2:25 AM
Subject: [Tutor] Another __builtins__.__dict__ question


> I'm surprised that
> 
> __builtins__.__dict__.keys().sort()
> 
> returns nothing.
> 
> Could someone explain this, please?
> 
> Poor Yorick
> gp@pooryorick.com