[Python-Dev] Python 2.3a1's mandatory use of cyclic GC causes existing applications to fail
Guido van Rossum
guido@python.org
Thu, 06 Feb 2003 14:46:24 -0500
> On Thu, 6 Feb 2003, Guido van Rossum wrote:
> > Can you suggest a concrete syntax to do this? Maybe setting __slots__
> > to a dictionary mapping names to type specifiers would do it -- and it
> > would even be backwards compatible: currently, if __slots__ is a dict,
> > its keys are used as slot names and its values are ignored, by virtue
> > of the way the type constructor iterates over __slots__.
>
> I already use __slots__ assigned to dictionaries where the values are not
> ignored. They are interpreted by a metaclass to apply type conversion
> operators and type/value enforcement predicates to slots. I hope that
> future versions of Python will not tread on this feature. (Though I'd
> happily trade in this feature in exchange for having __slots__ be immutable)
Hm... Given this feedback, it sounds like the only way to implement
Christian's suggestion in a backwards-compatible way would be to use a
different __xxx__ name, e.g. __fields__. I also like the suggestion
of allowing control over the order as well.
--Guido van Rossum (home page: http://www.python.org/~guido/)