On Tue, Nov 2, 2010 at 3:11 PM, Vitja Makarov <[email protected]> wrote:
> 2010/11/3 Vitja Makarov <[email protected]>:
>> Hmm... yes patch is here... I run fails on classmethod tests ;( don't
>> know how to solve this yet but all others are okay.
>>
>> This patch also includes some tests for __metaclass__ and one more
>> test for staticmethod
>>
>> 2010/11/3 Robert Bradshaw <[email protected]>:
>>> On Tue, Nov 2, 2010 at 2:20 PM, Vitja Makarov <[email protected]> 
>>> wrote:
>>>> It worked!
>>>
>>> Excellent! Do you have a patch?
>>>
>>>> I've enabled binding and used ExprNodes.PyCFunctionNode instead of
>>>> ExprNodes.PyCFunctionNode in DefNode.synthesize_assignment_node().
>>>>
>>>> Btw __new__ is still decorated with @staticmethod...
>>>> To solve this PyCFunctionNode should be used for __new__ and probably
>>>> for all static methods?
>>>
>>> __new__ should be a class method, not a static method, right? This
>>> trick should work fine for static methods. Also, I should note that
>>> __new__ will require a bit more work to implement fully.
>>>
>
> http://docs.python.org/reference/datamodel.html#basic-customization
>
> """Called to create a new instance of class cls. __new__() is a static
> method (special-cased so you need not declare it as such) that takes
> the class of which an instance was requested as its first argument.
> The remaining arguments are those passed to the object constructor
> expression (the call to the class). The return value of __new__()
> should be the new object instance (usually an instance of cls)."""

I was actually thinking about cdef classes, where __new__ is much more
subtle. I didn't realize it was a static method that takes the class
as a first argument rather than just a class method.

> Btw classmethods are now broken :(

Well, the fix will probably involve cleaning up some hacky
workarounds, which will be good.

- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to