On Sun, Apr 4, 2010 at 1:44 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> On Mon, 5 Apr 2010 09:03:17 am average wrote:
>> presently).  That includes dir() too and probably others.
>
> You are confused -- globals() and locals() don't return lists.

Yeah, this thread is mostly a mess (what would nonlocals() return
anyway?), but there is one serious suggestion in there. Maybe dir()
should return a set.

Points in its favor:

* The results of dir() are non-repeating
* The order of items returned by dir() is not especially important
* It would make "method" in dir(obj) marginally faster

Points against:

* It would break code that tried dir(obj)[0] (but why would anyone do that?)
* Even though the order isn’t important for code, it’s convenient at
the interactive prompt to see the methods of an item in alphabetical
order for quick scanning.

Overall:

-0

My two bits.

-- Carl Johnson
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to