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/012933.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)Jeremy Hylton jeremy@alum.mit.edu
Thu, 15 Feb 2001 18:34:31 -0500 (EST)
>>>>> "SM" == Skip Montanaro <skip@mojam.com> writes:

  Fredrik> can anyone explain why it's a good idea to have totally
  Fredrik> incomprehensible stuff like

  Fredrik> __all__ = locals().keys() for _i in
  Fredrik> range(len(__all__)-1,-1,-1): if __all__[_i][0] == "_": del
  Fredrik> __all__[_i] del _i

  Fredrik> in my code?

  SM> Please don't shoot the messenger... ;-)

  SM> In modules that looked to me to contain nothing by constants, I
  SM> used the above technique to simply load all the modules symbols
  SM> into __all__, then delete any that began with an underscore.  If
  SM> there is no reason to have an __all__ list for such modules,
  SM> feel free to remove the code, just remember to also delete the
  SM> check_all() call in Lib/test/test___all__.py.

If __all__ is needed (still not sure what it's for :-), wouldn't the
following one-liner be clearer:

__all__ = [name for name in locals.keys() if not name.startswith('_')]

Jeremy



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