Mutable Stings
Griebel, Peer
Peer.Griebel at entire.de
Mon Sep 16 09:01:38 EDT 2002
Hi,
I do understand that strings are immutable. This is the reason (I think)
that the class str does not define the methods e.g. __iadd__().
Now I had a look at UserString.py. It says that the class UserString
provides a wrapper class for immutable strings. Therefore it can safely
define the method hash(). (In contrast the class MutableString raises an
exception when hash() is going to be called.)
My problem now is that UserString does provide the method __iadd__ which
does an in-place modification of the string (self.data)! This would result
in a non constant hash value!
So my question: Is this correct - or did I overlook something?
connection reset by
Peer
--
Dr. Peer Griebel Tel: +49(0) 731 / 9 74 95-0
Dipl. Inform. Fax: +49(0) 731 / 9 74 95-20
Entire Software AG mailto:Peer.Griebel at entire.de
Pfarrer-Weiß-Weg 10 - 12
D-89077 Ulm http://www.entire.de
More information about the Python-list
mailing list