Suggestion for the PythonDevelopment for next version

Erik Max Francis max at alcyone.com
Tue Oct 14 04:47:52 CEST 2008


azrael wrote:

> I know that. enumerate is a great function. But this way it always
> adds some complexity.


That objection doesn't really make sense.  Your suggestion is far more 
complex:  It requires that an `index` attribute be added to every 
element in an iteration.  What's the lifetime of that attribute?  Is it 
a real attribute, permanently attached to the item?  What about for 
objects that already have an `index` attribute?  If it's a "virtual" 
attribute, how long does it last?  Is the iterated object a 
newly-created wrapper object for the purposes of providing that 
attribute?  If so, how do you make that more efficient than just 
creating a new object for each object you iterate over?  And so on.

Just use `enumerate`.  That's what it's there for.

> 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
> powerfull.

The problem is your suggestion would make Python a worse tool, not a 
better one.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
  San Jose, CA, USA && 37 18 N 121 57 W && AIM, Y!M erikmaxfrancis
   Triumph cannot help being cruel.
    -- Jose Ortega y Gasset



More information about the Python-list mailing list