Re: assignment in a for loop
- From: "MackS" <mackstevenson@xxxxxxxxxxx>
- Date: 16 May 2006 22:26:47 -0700
Thank you for your reply.
1) Is what I wrote above (minimally) correct?
Correct for what? You can tell if it's *syntactically* correct by
simply running it.
As for any other "correct", define that. Does it do what you want it
to do?
I was referring to my attempted explanation, not the code snippet.
[...]
What's preventing the use of list comprehensions?
new_list = [x+1 for x in old_list]
Suppose I want to do anything as trivial as modify the values of the
list members _and_ print their new values. List comprehensions must not
contain statements, I think.
Mack
.
- Follow-Ups:
- Re: assignment in a for loop
- From: bruno at modulix
- Re: assignment in a for loop
- From: Ben Finney
- Re: assignment in a for loop
- References:
- assignment in a for loop
- From: MackS
- Re: assignment in a for loop
- From: Ben Finney
- assignment in a for loop
- Prev by Date: Re: python vs perl lines of code
- Next by Date: Re: A Unicode problem -HELP
- Previous by thread: Re: assignment in a for loop
- Next by thread: Re: assignment in a for loop
- Index(es):