Suggestion for the PythonDevelopment for next version
kirk at athena.daycos.com
Mon Oct 13 18:27:35 CEST 2008
At 2008-10-13T16:11:26Z, azrael <jura.grozni at gmail.com> writes:
> I know that. enumerate is a great function. But this way it always
> adds some complexity. I think that it is more better to give a man a
> better tool then to let him play with a not so good one. People like
> Python because of his simplicity in comparison with c++. Maybe People
> would like him even more it would be a bit more simple but the same
"enumerate" doesn't add complexity: it adds specificity. When you use it,
there is no question of intent. You are saying, explicitly, that you're
going to want to use the index.
Your way adds an enormous amount of complexity in that it's magic behavior
with no obviously good implementation. What if the objects in my list
already have an attribute named "index" and I don't want your loop
contstruct to overwrite it? What if I never use enumerate as it is and
don't want to pay for the extra overhead of modify every object I'll ever
get from an iterator?
Thanks, but no. One of the things I love about Python is its lack of magic.
The Day Companies
More information about the Python-list