Re: Is it bad practise to write __all__ like that

2011-07-29 Thread OKB (not okblacke)
Thomas Rachel wrote: > class AllList(list): > """list which can be called in order to be used as a > __all__-adding > decorator""" Wow, this is a great idea. -- --OKB (not okblacke) Brendan Barnwell "Do not follow where the path may lead. Go, instead, where there is no path,

Re: Is it bad practise to write __all__ like that

2011-07-29 Thread Karim
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

Re: Is it bad practise to write __all__ like that

2011-07-29 Thread mark ferguson
Thomas, A ha! Now I feel all warm and fuzzy inside. It's nice to start the day with learning something new. To be honest, the initial problem was that I didn't understand the meaning of '__all__', again probably from not working in the large with python. After posting, I went and had another go a

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread Thomas Rachel
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 mis

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread Erik Max Francis
Thomas Rachel wrote: Why not? But you could even do class AllList(list): """list which can be called in order to be used as a __all__-adding decorator""" def __call__(self, obj): """for decorators""" self.append(obj.__name__) return obj __all__ = AllList() @__

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread Ian Kelly
On Thu, Jul 28, 2011 at 7:22 AM, mark ferguson wrote: > I've not really got the hang of decorators yet, so I was wondering why one > might use your approach rather than just using Karim's original method? The advantage of Thomas's decorator here is that it lets you place the denotation of whether

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread mark ferguson
HI Thomas, I've not really got the hang of decorators yet, so I was wondering why one might use your approach rather than just using Karim's original method? I only really use python for smallish, utility programs, so I suppose I haven't come across an issue complex enough to see a clear advantag

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread Karim
On 07/28/2011 02:29 PM, Thomas Rachel wrote: __all__ = AllList() Hello Thomas, Very beautiful and elegant code. Having both at the same time an instance and a method... With this 'small' topic, you taught me something today on property application! Cheers Karim -- http://mail.python.org/ma

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread Thomas Rachel
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 or

Re: Is it bad practise to write __all__ like that

2011-07-28 Thread Ben Finney
Karim writes: > Hello, > > __all__ = 'api db input output tcl'.split() > > or > > __all__ = """ >api >db >input >output >tcl >""".split() Maybe this: __all__ = [x.__name__ for x in [ api,

Is it bad practise to write __all__ like that

2011-07-28 Thread 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? Cheers Karim -- http://mail.python.or