[Python-Dev] Classmethod Help (original) (raw)
Raymond Hettinger python@rcn.com
Mon, 25 Nov 2002 18:07:05 -0500
- Previous message: [Python-Dev] Windows builders?
- Next message: [Python-Dev] Classmethod Help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
GvR pointed me to you guys for help in the C implementation of the patch for a dictionary class method:
class dict: def fromseq(cls, iterable, value=None): """Return a new dictionary with keys from iterable and values equal to value.""" result = {} for elem in iterable: result[elem] = value return result fromseq = classmethod(fromseq)
print dict.fromseq('collaborative') print dict().fromseq('associative')
I've already C code the fromseq() as defined as above. The question is how to make it a class method and attach it to the dictionary type object.
If you can help, please send me a note. Thanks in advance.
BTW, I know this is ordinarily not the place to ask for help, but there are only a handful of people who understand descriptors at the C level (and most of them are currently 100% consumed by Zope priorities).
Raymond Hettinger
- Previous message: [Python-Dev] Windows builders?
- Next message: [Python-Dev] Classmethod Help
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]