Newsgroups: comp.lang.python
From: Christos "TZOTZIOY" Georgiou <t...@sil-tec.gr>
Date: Wed, 31 Dec 2003 04:04:47 +0200
Local: Tues, Dec 30 2003 9:04 pm
Subject: Re: Storing objects required by functions.
On 31 Dec 2003 00:08:47 GMT, rumours say that b...@oz.net (Bengt
Richter) might have written: >The other way is to take advantage of functions' roles as decriptors and the mechanism that It's much more general to use new.instancemethod. See: >makes bound methods with a self as the first arg, but the rest apparently normal. I.e, >we can put the r parameter in the place of self (not specifically tested) > def uses_self(r, x): def voodoo(function, *its_arguments): The import statement is in the voodoo just for completeness including it getter = voodoo(getattr, my_object, "its_attribute") or the more modern getter = voodoo(operator.itemgetter("its_attribute"), my_object) and similarly setter = voodoo(operator, my_object, "its_attribute") allowing setter(value) at good speeds. I have a module predicates.py defining All and Any classes for You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||