Status of PEP's?
James_Althoff at i2.com
James_Althoff at i2.com
Wed Mar 6 14:53:15 EST 2002
[Andy Gimblett]
> This just came to me:
>
> for index in indices(items):
> pass
>
> or maybe better yet:
>
> for index in items.indices():
> pass
Warning: the latter could get you into trouble with the "methods are
overrated" crowd <wink>.
Some folks, indeed, are fond of this suggestion.
Two points:
1) PEP 276 doesn't prevent "indices" from being added.
2) The "indices" approach is not general enough to handle the example used
in PEP 276.
>>># not the real thing, but an incredible simulation <wink>
>>>
>>>for rowindex in indices(mytable):
>>> print mytable.getValueAt(rowindex,0)
>>>...
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: len() of unsized object
>>>
Jim
More information about the Python-list
mailing list