On 29 August 2010 14:06, Stefan Behnel <[email protected]> wrote: > > Agreed for the "cdef __dict__" syntax. However, is there a reason why > extension types can't provide modifiable __dict__ support by default?
I do not care if you what type dict's modifiable by default, as long as you grant me a compiler directive to switch the feature off. > After > all, subtypes can basically override all sorts of internals anyway, so > there's not much of a difference if __dict__ is used to override them or if > a subtype does that. Does anyone know of a reason why it could result in > unexpected/unwanted behaviour if we make all extension type dicts modifiable? > Perhaps the ext type could break if users are able to change things in __dict__. Suppose you have two methods, both updating some internal cache or other internals... then if you let users to change one of these methods, the other could behave bad. > If the problems are just related to types that are not supposed to be > subtyped in the first place, the long-proposed "final" modifier would be a > better solution (and it would simply make the type __dict__ read-only as > before). > It could work, too. But IMHO, a directive would be better: no need for special syntax and it can be globally set. -- Lisandro Dalcin --------------- CIMEC (INTEC/CONICET-UNL) Predio CONICET-Santa Fe Colectora RN 168 Km 472, Paraje El Pozo Tel: +54-342-4511594 (ext 1011) Tel/Fax: +54-342-4511169 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
