On Fri, 20 Apr 2007 15:53:45 -0700, garrickp wrote:

> Speaking of inessential but very useful things, I'm also a big fan of
> the tuple swap...
> a = 2
> b = 3
> (a, b) = (b, a)

Since tuples are made by commas, not brackets, that can be written more
cleanly as:

a, b = b, a

The only exception is the special case of an empty tuple, which can be
written as ().

> IMO, the biggest thing going for tuples is the syntactical sugar they
> bring to Python.

More important than the ability to use them as keys in dicts?


-- 
Steven.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to