New Features in Python 1.6

Tom Culliton culliton at
Sat Apr 1 14:00:28 EST 2000

OK, it's April 1st so maybe I'm just not getting the joke but...

In article <200004011740.MAA04675 at>,
Guido van Rossum  <guido at> wrote:
>New Features in Python 1.6


>Note that use of any string method on a particular string renders it
>mutable.  This is for consistency with lists, which are mutable and have
>methods like 'append()' and 'sort()' that modify the list.  Thus,
>"foo.strip()" modifies the string 'foo' in-place.  "strip(foo)" retains
>its old behavior of returning a modified copy of 'foo'.

Violating immutablity like this seem like a misfeature and potential
source of nasty bugs unless there is some kind of copy on write going
on.  For example, imagine A is set to a string value, which is used as
a dictioanry key, and then passed to a fucntion, which passes it to
another function, which modifies it in place.  Suddenly the dictionary
keys aren't unique since the same value was shared by all.  Just the
thought scares me snotless.

>4. assignment to None now works

Huhn?  What exactly changed here?  You can assign to None in current
versions just like you can to any other name.  I thought the push was
to _prevent_ this.

Python 1.5.2 (#1, Sep 17 1999, 20:15:36)  [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> def xyz(a):
...     global None
...     None = a
>>> def abc(a):
...     if a == None:
...             print "None-sense!"
>>> xyz(42)
>>> abc(42)

>In previous version of Python, values assigned to None were lost.  For
>example, this code:
>    (username,None,None,None,realname,homedir,None) = getpwuid(uid)
>would only preserve the user name, real name, and home directory fields
>from a password file entry -- everything else of interest was lost.
>In Python 1.6, you can meaningfully assign to None.  In the above
>example, None would be replaced by a tuple containing the four values of

This is either nasty unpythonic special case magic or a much broader
change.  The current behaviour is the same whether you use the name
"None", "X", "y", "junk", ...  The name ends up refering to the last
value in the list.  The whole point of this type of assignment to None
(or junk, or ...) is usually to discard elements you don't want.  As a
general change it could be useful but may break existing code in a way
thats VERY hard to spot.

>You can also use the variable argument list syntax here, for example:
>    (username,password,uid,uid,*None) = getpwuid(uid)
>would set None to a tuple containing the last three elements of the
>tuple returned by getpwuid.

I'm not one of the folks who howl at tightening up the behaviour of
list.append, socket.connect and the like but these changes, especially
viloating immutability, strike me as too bizarre and dangerous for
words.  Please tell us it's just and April Fools joke!

More information about the Python-list mailing list