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

Carl Banks invalidemail at aerojockey.com
Thu Mar 10 18:14:39 EST 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