Code evaluation at function definition execution time (was Re: Compile time evaluation (aka eliminating default argument hacks))

Carl Banks invalidemail at aerojockey.com
Fri Mar 11 00:14:39 CET 2005


Carl Banks wrote:
> I could, however, see myself
> using the slightly more complicated descriptor such as this (for a
> wholly different reason, though):
>
> . def call_with_open_file(filename):
> .     def descriptor(func):
> .          flo = open(filename)
> .          try: f(flo)
> .          finally: f.close()
> .          return None
> .     return descriptor


Apparently, I don't know the difference between a descriptor and a
decorator.


-- 
CARL BANKS




More information about the Python-list mailing list