Is it bad practise to write __all__ like that
karim.liateni at free.fr
Fri Jul 29 11:54:41 CEST 2011
On 07/29/2011 08:37 AM, Thomas Rachel wrote:
> Am 28.07.2011 20:01 schrieb Ian Kelly:
>> The advantage of Thomas's decorator here is that it lets you place the
>> denotation of whether a function is exported alongside its definition,
>> whereas simply declaring the __all__ list forces you to separate them.
>> It also avoids the problem of possibly mistyping the function's name
>> in the list.
> Thank you. For the ones who do not like @__all__ because it might look
> ugly, here is an alternative:
> __all__ = 
> def export(obj):
> return obj
> It is nearly the same, but without an extra class and with the more
> def func(): pass
I did not plan that this topic introduce so many great ideas.
It started from a simple question and ended up with new
and beautiful solution.
Very pleased of the collective spirit of this mailing list.
It changed from non-sense verbal fightings I saw earlier in some discussions
like perl versus python related topic.
More information about the Python-list