problem in reading indices

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Dec 13 08:35:34 EST 2007


Xavier Barthelemy wrote:

> so when I call another array with these indices
> ArrayWithData[i,int(choice[i].current[0])]

You don't "call" "arrays" "with indices". You are indexing the list
ArrayWithData using the index "i,int(blah)" which is invalid.
Indices must be integers, not comma seperated values.
 
> so I tried an intermediate value, because sometimes, the oneliner
> code doesn't work, so with an intermediate passage:
> value=int(choice[i].current[0])
> ArrayWithData[i,value]
> 
> I have the same error
> 
> and I don't understand why. What's wrong?
> May anyone have an idea?

I'm afraid not! You didn't specify at all what you'd like to achieve
(just "it doesn't work! why?), and clairvoyance isn't as easy as it
looks.

If you want to slice, don't use Perl syntax. Python uses a colon for
index separation to eliminate ambiguities.

some_elements = my_list[3:10]

Regards,


Björn


-- 
BOFH excuse #343:

The ATM board has run out of 10 pound notes.  We are having a whip
round to refill it, care to contribute ?




More information about the Python-list mailing list