Modifying the {} and [] tokens

Terry Reedy tjreedy at udel.edu
Sat Aug 23 19:39:15 CEST 2003


"Geoff Howland" <ghowland at lupineNO.SPAMgames.com> wrote in message
news:km4fkv8qbbge3mvckv5gsim9amq59qvohb at 4ax.com...
> For the [].len() type things, this is obviously a matter of taste

There is also history (and backwards compatibility).  Once upon a
time, neither strings nor tuples had methods, so neither 'abc'.len()
nor (1,2,3).len() would have been possible.

With respect to {}+{}.  An in-place version of this is currently
spelled {}.update({}).  Yes, more chars to type, but also more
'honest' in not implying symmetry between the two dicts.  As the name
suggests, duplicate key with new value overrides previous value.

Terry J. Reedy






More information about the Python-list mailing list