Are decorators really that different from metaclasses...

Paul Morrow pm_mon at yahoo.com
Mon Aug 30 02:28:30 CEST 2004


Steven Bethard wrote:
> Paul Morrow <pm_mon <at> yahoo.com> writes:
> 
>>Have you seen a significant number of cases where a function uses
>>__xxx__ names for local variables?  Have you seen any?
> 
> 
> Are there any examples currently of functions that use __xxx__ names in their 
> body at all?  I haven't seen this, but I haven't really looked...
> 
> STeve
> 

I've seen some that define a few of the pydoc variables (__author__, 
__version__, etc), although pydoc doesn't recognizes them there.  I 
remember reading a whitepaper on a web templating framework that made 
use of them too, where each function corresponded to an html tag and the 
__xxx__ variables controlled caching (memoizing), which database tables 
were involved, etc.

For classes and modules of course you'll see more examples of __xxx__ 
variables describing meta aspects of the class/module (__metaclass__, 
__future__, etc.), so it seems consistent that they could describe meta 
aspects of functions too.




More information about the Python-list mailing list