Dag Sverre Seljebotn, 29.01.2010 19:31:
> Stefan wrote:
>> Danilo Freitas, 29.01.2010 19:05:
>>> 2010/1/29 Stefan Behnel :
>>>> One thing that strikes me: Is "new" a keyword now? I don't find that a
>>>> good
>>>> idea - it will break existing code at best. Why was this chosen over
>>>> something like "cython.new()"? Or is it only enabled when compiling C++
>>>> code? That would be bad enough, but would at least make it less likely
>>>> to break code.
>>> I didn't think about that. I just thought using 'new' like C++ would
>>> be very simple.
>> It's not very pythonic, though. I think a function makes more sense.
>>
>> I assume there is a reason why calling the constructor isn't enough?
> 
> I'm opposed to just calling the constructor.
> 
> Everywhere else a constructor is called, a refcounted reference is
> returned. It is good to be very explicit about the fact that the pointer
> must be freed, and that this is dissimilar from instantiating Cython
> classes.

Fair enough. Back to the keyword question then. 'new' isn't a completely
uncommon word to use in Python code:

http://www.google.com/codesearch?q=^[^%23]*new[^a-z0-9_]+lang%3Apython

It makes perfect sense as name of a factory method name keyword argument or
(boolean) variable. I expect that a lot of people use it in their code.
Making it a keyword will break all that.

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

Reply via email to