Erik Max Francis
max at alcyone.com
Tue Sep 5 19:32:13 CEST 2000
Jonadab the Unsightly One wrote:
> So, a Python string is essentially a dictionary word, then?
It depends on precisely what you mean by "dictionary word." Python
strings are immutable; they can't be changed. If you want to, say,
replace some characters in a string or add some on the end, you have to
create a new string. Dictionary keys have to be immutable (because
changing the keys behind the data structure's back would be a bad
thing), and so since strings are immutable they can be used as
dictionary keys. That is, they're immutable _so that_ they can serve as
dictionary keys, not because they _are_ them.
> Weird. Coming from a language (Inform) which has separate
> data types for strings and dictionary words, BOTH of which
> are immutable, I'm starting to get curious about the other
> features of Python strings... time to leave the ng and
> start reading the docs, I suppose...
Remember, though, that Inform is a very special purpose. When using it
as a model for comparison with other languages, one should expect to
have strange reactions ("Weird"), as it is not your typical language.
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Every exit is an entry somewhere else.
\__/ Tom Stoppard
Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
A new, virtual planet, every day.
More information about the Python-list