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 th
azrael wrote:
I know that. enumerate is a great function.
Agreed. Enumerate works everywhere an iterable is wanted.
Just like other functions that produce iterables.
A special trick for for-loops would only work for for-loops.
--
http://mail.python.org/mailman/listinfo/python-list
case closed
--
http://mail.python.org/mailman/listinfo/python-list
At 2008-10-13T16:11:26Z, azrael <[EMAIL PROTECTED]> 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 sim
azrael wrote:
> 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
>
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
On Mon, 13 Oct 2008 08:56:34 -0700 (PDT), azrael <[EMAIL PROTECTED]> wrote:
You know, sometimes it annoys me to write a for loop in Python. If we
use a list a=[1,2,3,4], and want to loop through it, Python offers the
next option
for i in a:
print i
1
2
3
4
I love this. So simple and smooth.
azrael wrote:
> You know, sometimes it annoys me to write a for loop in Python. If we
> use a list a=[1,2,3,4], and want to loop through it, Python offers the
> next option
for i in a:
print i
> 1
> 2
> 3
> 4
>
> I love this. So simple and smooth. But what happens if we need also
>
You know, sometimes it annoys me to write a for loop in Python. If we
use a list a=[1,2,3,4], and want to loop through it, Python offers the
next option
>>>for i in a:
>>> print i
>>>
1
2
3
4
I love this. So simple and smooth. But what happens if we need also
the position of an object in a list.