Le 28/10/2011 11:08, Hrvoje Niksic a écrit :

longer be allowed for the interpreter to transparently cache them.  The
same goes for integers and other immutable built-in objects.


On the other hand, immutability and optimization don't explain the whole thing because you can't do something like [].bar = 42.




If you really need to attach state to strings, subclass them as Steven
explained.  All code that accepts strings (including all built-ins) will
work just fine, transparent caching will not happen, and attributes are
writable.

OK, thanks, I'll consider it seriously. Actually I have a directed graph whose nodes are given as string but it's oversimplistic to identify node and string (for nodes requiring specific methods).
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to