Tuple Format?

Quinn Dunkan quinn at krone.ugcs.caltech.edu
Fri Sep 1 23:53:30 CEST 2000


On Fri, 01 Sep 2000 17:11:26 GMT, Grant Edwards <ge at nowhere.none> wrote:
>In article <Pine.GSO.4.10.10009011423130.22219-100000 at sundial>, Moshe Zadka wrote:
>>On Thu, 31 Aug 2000, Gene C wrote:
>>
>>> Has anyone considered a different format for tuples to get around the
>>> somewhat strange single element tuple format? I find when explaining the
>>> language to others, the single tuple format always solicits a, "Thats
>>> weird."
>>
>>That's because you're not explaining it correctly. Paraphrasing the NRA,
>>"parens don't build tuples, commas build tuples". 
>
>What about ()?

The single tuple format *is* weird.  The tutorial says so: "A  special
problem is the construction of tuples containing 0 or 1 items: the  syntax
has  some extra quirks to accommodate these."  Python has some weird bits.
They're generally not seriously weird, though.

There have been a few random discussions about alternate ways to write tuples,
but nothing is likely to change, because it would be grossly incompatible for
not much gain.  Other python-like languages approach this in different ways,
for example, ruby has no tuples, but has a 'freeze' method which marks an
object as immutable.  To each their own :)



More information about the Python-list mailing list