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

Ben Finney ben+python at benfinney.id.au
Fri Jun 19 08:13:36 EDT 2009


Albert van der Horst <albert at spenarnc.xs4all.nl> 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
<URL:http://docs.python.org/3.0/whatsnew/3.0.html#new-syntax>.

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



More information about the Python-list mailing list