python for loop

Lada Kugis lada.kugis at
Wed Apr 1 05:15:00 CEST 2009

On Wed, 01 Apr 2009 03:59:36 +0100, "Rhodri James"
<rhodri at> wrote:

>Two opportunities to forget to lie about how big your array is :-)

It is rank 3, meaning a33 is the last element. I don't see how any
alternative can be simpler than that.
>> I wrote in my other post, 0 is weird to me, I have model of solution
>> on paper ... if I keep 0 then all comes out different. And while
>> comparing, I always get them mixed up. That's why I always try to
>> adapt it to the paper situation.
>Ever considered adapting the paper situation to it?

And start mentally rewriting all the books on the subject - you must
be joking! The given one was a trivial example, used models are not
nearly that simple.

>  You might find
>that the results come out more naturally.

... the force in the third node, at b(2) ?

  Alternatively, idiomatic
>Python seems to have a strong tendency not to need subscripting,
>since you spend most of your time iterating through lists instead.

Yes, but you still need to give conditions, and for that you use
manually indexes. You need, for example, give force value at node 3,
which would come out as b(2).
Yes, there is a lot of iterating, but indexing is still important.

This loses some importance when you make a GUI, so you don't handle
all this manually, but I don't make (or know how to) those, so I'm
stuck with manual work ;-(

Still, tomorrow is a brand new day (rainy probably though).
I'm going to sleep, see you tomorrow.

More information about the Python-list mailing list