[Python-Dev] METH_CLASS (original) (raw)
Thomas Heller thomas.heller@ion-tof.com
Thu, 25 Apr 2002 15:26:11 +0200
- Previous message: [Python-Dev] METH_CLASS
- Next message: [Python-Dev] METH_CLASS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: "Guido van Rossum" <guido@python.org>
> The devel-docs tell me about METHCLASS: [...] > 2. Since this is marked new in 2.3: Is it planned to backport > this stuff into the 2.2.x series? > Requiring Python 2.3 for my stuff seems a but harsh currently...
I don't plan to backport this to 2.2 unless there's an overwhelming demand.
What do you accept as overwhelming? The only person I could think of currently beside me is David Abrahams, but maybe I'm wrong ;-)
You have to call classmethod() from C; it's available as &PyClassMethodType, you can call it with e.g. PyObjectCall. The argument should be a function object that you created by calling PyCFunctionNew. Then stick it into your type's tpdict (after calling PyTypeReady()).
I know that's complicated; that's why we added METHCLASS. :-) I'd recommend against trying this unless you absolutely need it.
I need it, so I asked :-) But I'm fine with your recipe (in these cases where I don't have a custom metaclass).
Thanks,
Thomas
- Previous message: [Python-Dev] METH_CLASS
- Next message: [Python-Dev] METH_CLASS
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]