PEP 276 -- What else could iter(5) mean?
bokr at oz.net
Sun Mar 3 23:11:50 CET 2002
On 3 Mar 2002 12:50:24 GMT, scarblac at pino.selwerd.nl (Remco Gerlich) wrote:
>Cromwell, Jeremy <jcromwell at ciena.com> wrote in comp.lang.python:
>> If python was to allow "for i in 5:", is there any other meaning that would
>> be appropriate besides the one detailed in PEP 276?
>It should give an error - 5 is not a sequence, so 'i in 5' is nonsense.
No, it's not nonsense. 'i in 5' is a probability, so
for i in 5:
should have an i/5.0 chance of executing do_this().
More information about the Python-list