Is it bad practise to write __all__ like that
ben+python at benfinney.id.au
Thu Jul 28 13:52:36 CEST 2011
Karim <karim.liateni at free.fr> writes:
> __all__ = 'api db input output tcl'.split()
> __all__ = """
__all__ = [x.__name__ for x in [
presuming these are all objects with an accurate ‘__name__’ attribute.
I'm starting to yearn for the ability in Python to get a string
representation of a name itself, by using the name and not writing it as
a string literal. That would make the above more robust.
But really, this is all obfuscatory. Why not:
__all__ = [
It's clear and explicit and really not difficult to type or maintain.
\ “I do not believe in forgiveness as it is preached by the |
`\ church. We do not need the forgiveness of God, but of each |
_o__) other and of ourselves.” —Robert G. Ingersoll |
More information about the Python-list