[Pythonmac-SIG] cross-platform puzzle

Charles Hartman charles.hartman at conncoll.edu
Tue Feb 22 04:29:54 CET 2005


On Feb 21, 2005, at 9:15 PM, Bob Ippolito wrote:

> Note that strings are immutable in Python, and if "Dict" has strings 
> for values then the copy-by-slice is extraneous.  There's no reason to 
> make a copy of an object that can't possibly be changed.  I'm pretty 
> sure that slicing a string like that is going to return the same 
> object anyway.

The value (not the key) is a list of strings. The strings are 
immutable, but (if I understand rightly) the list is not. Without the 
slice-copy, when I later replace one of the strings *in* the list, the 
dictionary's own list gets changed.

Your suggestion about whitespace sounds entirely plausible. I thought 
of something along that line, and looked for it with some care. But 
obviously I must have missed something -- and strings-with-whitespace 
are the only plausible Win/Mac distinction in the vicinity. If I can 
get at the Windows machine tomorrow I'll try to check this again.


Charles Hartman



More information about the Pythonmac-SIG mailing list