Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32604 > unrolled thread

Re: pythonic way

Started byjack <naruto0.1@live.cn>
First post2012-11-02 16:58 +0800
Last post2012-11-02 16:58 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: pythonic way jack <naruto0.1@live.cn> - 2012-11-02 16:58 +0800

#32604 — Re: pythonic way

Fromjack <naruto0.1@live.cn>
Date2012-11-02 16:58 +0800
SubjectRe: pythonic way
Message-ID<mailman.3186.1351846748.27098.python-list@python.org>
thanks,but I don't think enumerate() is my want
Have some ways to operate the reference of element,not a copy when I 
tried to traverse a list?

I'm so sorry about my poor English, hope you don't mind it.

On 2012/11/2 15:56, Chris Angelico wrote:
> On Fri, Nov 2, 2012 at 6:14 PM, jack <naruto0.1@live.cn> wrote:
>> Sometimes, I need to alter the element as traverse a list like this (it's a
>> sample):
>>      c = range(10)
>>      i = 0
>>      for ele in c:
>>          # do something
>>          # branch:
>>              c[i] = # value
>>          i += 1
>>
>> How to be pythonic?
> Check out the enumerate() function.
>
> ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web