another puzzled newbie
Elaine Jackson
elainejackson7355 at home.com
Thu Aug 28 21:52:55 EDT 2003
"Chad Netzer" <cnetzer at sonic.net> wrote in message
news:mailman.1062051053.30902.python-list at python.org...
<snip>
| > def singlePass(shuffler,preshuffled,postshuffled):
| > postshuffled+=[preshuffled[shuffler[0]]
| ^
| You forgot a ']' at the end of the line
Right. How embarassing. Thank you.
<snip>
| You don't need the '(' and ')' here. del is a keyword, not a function.
Can't it be both? Could you explain why it fails to be a function?
<snip>
| > for i in range(len(shuffler)):
| > shuffler[i]+=(-1)
| ^^^^
| If you want a tuple here, it should be (-1,). It needs the comma.
| But, since shuffler is a list, you probably really want [-1].
No, I want (-1) the integer. My problem is that I really dislike the appearance
of a statement like X-=Y. (Even right now I can barely stand writing it.) So I
wrote X+=(-Y) instead. Maybe it would look better as shuffler=map(lambda n: n-1,
shuffler)?
Thanks again, and muchas gracias to the other respondents as well.
Peace,
EJ
More information about the Python-list
mailing list