Robert Bradshaw, 12.04.2010 19:23:
> On Apr 12, 2010, at 6:35 AM, Lisandro Dalcin wrote:
>
>> On 12 April 2010 04:10, Stefan Behnel wrote:
>>>
>>>   >  * Non-GC Extension Types
>>>
>>> +1 for the feature, -1 for the syntax. Python 3 has keyword
>>> arguments in
>>> the baseclass tuple, so this would be much better here:
>>>
>>>      cdef class Spam(gc=False):
>>>          cdef object sausage
>>
>> I agree with Stefan here...
>
> I think a class decorator would be even more natural here.

Right, and it would work more easily in pure Python (2.x) code as well.


>>>   >  * As I have been threatening for some time, using __new__ as the
>>> name of
>>>   >  the initialisation method of an extension type has become an error
>>>   >  rather than just a warning. In some future release, __new__ will
>>>   >  re-emerge with more Python-like semantics.
>>>
>>> I have wanted __new__ support for quite a while now, so I think
>>> this is the
>>> right thing to do. Cython already has a ticket about __new__, and we
>>> discussed this feature before I opened it, so no problem here, I
>>> guess.
>>>
>>> http://trac.cython.org/cython_trac/ticket/238
>>
>> +1
>
> Lets defer this change until I can make sure the Sage codebase is
> clean. We should make it a visible warning at least first.

The compile time error that you will get if your __new__ function does not 
define its return type or returns without a return value is very clear and 
will catch 100% of the then incorrect cases, so I don't see a major use in 
making this deprecated first. All a user has to do to fix this is rename 
__new__ to __cinit__.

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

Reply via email to