preferring [] or () in list of error codes?

Ben Finney ben+python at
Fri Jun 19 08:13:36 EDT 2009

Albert van der Horst <albert at> writes:

> But I greatly prefer a set
> "
>         for i in {point1,point2,point3}:
>             statements
> "

Agreed, for the reasons you cite. I think this idiom can be expected to
become more common and hopefully displace using a tuple literal or list
literal, as the set literal syntax becomes more reliably available on
arbitrary installed Python versions.

> [Yes I know { } doesn't denote a set. I tried it. I don't know how to
> denote a set ... ]

Try it in Python 3 and be prepared to be pleased

 \                   “Too many Indians spoil the golden egg.” —Sir Joh |
  `\                                                   Bjelke-Petersen |
_o__)                                                                  |
Ben Finney

More information about the Python-list mailing list