Tuples -- who needs 'em

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Apr 6 22:06:10 EDT 2000


Martijn Faassen wrote:
> 
> def foo():
>     return 1, 2, 3, 4
> 
> first, second, third, fourth = foo()
> 
> I think this is nice syntax.

It is very nice. Just a pity it loses its beauty in 
the case of 1-tuples.

Haskell avoids this problem by simply not having
any such thing as a 1-tuple. It works there because
you never need a 1-tuple in Haskell -- a bare value
always does just as well. 

Unfortunately, Python *does* need 1-tuples. If
only ASCII had more kinds of brackets, Guido might
have chosen differently. Maybe if Python 3000 uses
Unicode for source files...

-- 
Greg Ewing, Computer Science Dept,
+--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-list mailing list