Is it bad practise to write __all__ like that

Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at
Thu Jul 28 14:29:00 CEST 2011

Am 28.07.2011 13:32 schrieb Karim:
> Hello,
> __all__ = 'api db input output tcl'.split()
> or
> __all__ = """
> api
> db
> input
> output
> tcl
> """.split()
> for lazy boy ;o). It is readable as well.
> What do you think?

Why not? But you could even do

class AllList(list):
     """list which can be called in order to be used as a __all__-adding 
     def __call__(self, obj):
         """for decorators"""
         return obj

__all__ = AllList()

def api(): pass

def db(): pass

def input(): pass

def output(): pass

def tcl(): pass



More information about the Python-list mailing list