A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-April/099072.html below:

[Python-Dev] nonlocals() function?

[Python-Dev] nonlocals() function? [Python-Dev] nonlocals() function?Carl M. Johnson cmjohnson.mailinglist at gmail.com
Mon Apr 5 05:21:44 CEST 2010
On Sun, Apr 4, 2010 at 1:44 PM, Steven D'Aprano <steve at 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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4