deferred decorator

Bryan belred1 at
Wed Dec 8 03:13:48 CET 2004

i was intrigued with a recently posted cookbook recipe which implements deferred 
results with decorators:

the problem i see with this recipe is that the author only tested his code by 
printing the values which causes __getattr__ to be called with '__str__' and 
work correctly.  but, if you were to remove the print statements and just do a v 
+ v, __getattr__ won't get called as he expected and the join will never happen. 
   i think by making __coerce__ as smart as __getattr__ this recipe would work. 
  can someone validate that i'm correct in what i'm saying?

i'm also curious if it's possible to write this recipe using the new class style 
for the Deffered class.    it appears you can nolonger delegate all attributes 
including special methods to the contained object by using the __getattr__ or 
the new __getattribute__ methods.  does anyone know how to port this recipe to 
the new class style?



More information about the Python-list mailing list