[Python-Dev] PEP 318 (was re: redefining is)
David Eppstein
eppstein at ics.uci.edu
Wed Mar 24 17:12:48 EST 2004
In article <20040323224817.E8BD.JCARLSON at uci.edu>,
Josiah Carlson <jcarlson at uci.edu> wrote:
> > perhaps two distinct objects. How can one determine straightforwardly
> > whether those objects are members of the same equivalence class?
>
> You were there and helped point out some of the limitations of the
> original code I posted, which now has a _straightforward_ recursive
> implementation here:
> http://mail.python.org/pipermail/python-dev/2004-March/043357.html
Heh, another use for the class variant of PEP 318. Josiah's code
depends on knowing which classes have immutable instances, using a
hardcoded set of builtin types. With PEP318, one could do
class foo [immutable]:
...
with an appropriate definition of immutable that either decorates the
class object or adds to the set of known immutables. Perhaps also with
code to catch and warn against obvious attempts at mutation of foos...
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
More information about the Python-Dev
mailing list