[Zope3-dev] datetime module

Guido van Rossum guido@python.org
Thu, 07 Nov 2002 11:34:27 -0500


> > Too bad.  They could be made purely read-only by adding __slots__
> 
> How does that work?

Using read-only properties, you can prevent assignment to d.year etc.
Using slots, no other attribues are settable.

You'd still have to write something to prevent assignment to
d._datetime__year (which circumvents the private attribute name
protection); that could be done by a custom __setattr__.

--Guido van Rossum (home page: http://www.python.org/~guido/)