Robert Bradshaw, 31.10.2010 08:09:
> On Sat, Oct 30, 2010 at 11:09 PM, Stefan Behnel wrote:
>> Robert Bradshaw, 31.10.2010 04:34:
>>>> On 30 October 2010 22:16, Stefan Behnel wrote:
>>>>>      @cython.internal
>>> I also
>>> don't think such a feature is strictly necessary and complicates the
>>> language, but wouldn't stand in its way if I'm the only one.
>>
>> I just wrote a patch for lxml.etree that adds one or both of the decorators
>> where they make sense. (I won't apply it right away as the next release is
>> hopefully closer than the next release of Cython, but I'll keep it around
>> for one of the next releases after Cython 0.13.1.)
>>
>> It turns out that out of the 117 extension types in lxml.etree, 39 would be
>> happy about at least one of the decorators: 30x final and 36x internal. So
>> almost every third class is an internal one. Most of them are context
>> classes that are passed through C in one way or another and that are used
>> by internal callback code. Pure implementation details that no user should
>> ever mess around with or even care about.
>
> What about using the
>
> [cdef] class A:
>      ...
>
> del A
>
> idiom that people use for pure Python?

For example, the following doesn't work in Python:

     class Stuff(object): pass

     def use_stuff():
        Stuff()

     del Stuff

     use_stuff()

This is different for cdef classes in Cython, but that can be considered a 
bug to some extent. Arguably, that also sort-of applies to the decorator, 
but I think it makes it at least clearer what happens because it is part of 
the class declaration.

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

Reply via email to