Robert Bradshaw, 31.10.2010 04:34: > On Sat, Oct 30, 2010 at 2:12 PM, Lisandro Dalcin wrote: >> On 30 October 2010 22:16, Stefan Behnel wrote: >>> a while ago, we had agreed that a "final" directive would be nice to have >>> for cdef classes. I implemented the basics for that (i.e. "final" types are >>> no longer subclassable from Python), and I also added an "internal" >>> directive that prevents a type from appearing in the module dict. So you >>> can now write something like this for a type that you only use internally >>> in your module: >>> >>> @cython.final >>> @cython.internal >>> cdef class _MyInternalType: >>> ... >>> >>> http://trac.cython.org/cython_trac/ticket/263 >>> http://trac.cython.org/cython_trac/ticket/585 >>> >> >> Many thanks for this, Stefan!
I'm as happy as you are. >>> I think the "final" directive name was pretty much agreed on, but what >>> about the "internal" directive? Any objections to that? >> >> Perhaps "private" ? I still prefer "internal". > > I'd lean towards "private" but that's not a strong preference. I may be mistaken, but it looks like we don't actually use "private" anywhere in the language so far. I thought we did, but it currently seems to be a purely internal visibility marker. So to me, "internal" makes as much sense as "private". Robert, if you want me to change it, just say so clearly. ;) > 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. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
