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/2001-February/012934.html below:

[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib sre_constants.py (etc)

[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib sre_constants.py (etc) [Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib sre_constants.py (etc)Guido van Rossum guido@digicool.com
Thu, 15 Feb 2001 18:38:04 -0500
> can anyone explain why it's a good idea to have totally
> incomprehensible stuff like
> 
>     __all__ = locals().keys()
>     for _i in range(len(__all__)-1,-1,-1):
>         if __all__[_i][0] == "_":
>             del __all__[_i]
>     del _i
> 
> in my code?

Ask Skip. :-)

This doesn't exclude anything that would be included in import* by
default, so I'm not sure I see the point either.

As for clarity, it would've been nice if there was a comment.

If it is decided that it's a good idea to have __all__ even when it
doesn't add any new information (I'm not so sure), here's a cleaner
way to spell it, which also gets the names in alphabetical order:

# Set __all__ to the list of global names not starting with underscore:
__all__ = filter(lambda s: s[0]!='_', dir())

--Guido van Rossum (home page: http://www.python.org/~guido/)



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