On Tue, Jun 28, 2016 at 11:55 AM, MRAB <pyt...@mrabarnett.plus.com> wrote: > On 2016-06-28 01:32, Chris Angelico wrote: > [snip] > >> If you're primarily worried about classes and functions, here's a neat >> trick you can use: >> >> __all__ = [] >> def all(thing): >> __all__.append(thing.__name__) >> return thing >> > Err... won't that hide the 'all' builtin? >
Yep. So? If you're not using it *at top level*, it's not a problem. I clean up the namespace at the end, so if you use it inside a function, it'll still be available. And most of my scripts don't use 'all' anyway... it's no worse than using 'id' for a database ID. ChrisA -- https://mail.python.org/mailman/listinfo/python-list