Tuples -- who needs 'em
Bjorn Pettersen
bjorn at roguewave.com
Tue Apr 4 14:27:19 EDT 2000
Bob Alexander wrote:
[...]
> However, too bad about that nasty syntax irregularity that using parens for
> tuples presents (1,) (Couldn't resist ;-)
[...]
Contrary to popular belief, it's actually the comma that creates the
tuple, not the parens... As an example, I recently copied code from a
dictionary to an assignment a little to hasty:
foo = {
'a' : 1,
'b' : 2,
}
to:
a = 1,
b = 2,
and it took me way to long to figure out where the eventual "unpack
tuple of wrong size" error was coming from... *sigh* Serves me righ, I
suppose <wink>
--bjorn
More information about the Python-list
mailing list