[Pyrex] cdef private class ... ?
Stefan Behnel
stefan_ml at behnel.de
Sat Jan 12 09:54:15 CET 2008
Hi,
Lenard Lindstrom wrote:
> I'm not sure this should be handled with new syntax. I suggest using the
> del statement to remove the extension name from the module's dictionary.
> Here is an example:
>
> cdef class invisible:
> pass
>
> del invisible
>
> def new():
> return invisible()
I thought about that, too. It makes sense from a Python language point of
view, but I actually find it hard to read, as the "del" statement will appear
after the (possibly lengthy) class definition. So I'd be surprised to see a
declared class not appear in the module dictionary - until I look around and
find the del statement somewhere in the rest of the code (if I know I have to
look for it and understand what it does and how it interacts with Python names
and C names).
cdef private class ...
would be quite intuitive IMHO. Similarly, Kay's suggestion of using a class
decorator would also put the information at the right spot.
Stefan
More information about the Pyrex
mailing list