python references

2007-02-05 Thread dustin . getz
>>> from Numeric import zeros >>> p=zeros(3) >>> p array([0,0,0]) >>> p[0] 0 >>> x=p[0] >>> x=10 >>> p array([0,0,0]) #actual behavior #array([10,0,0]) #desired behavior I want x to be a C++-esque reference to p[0] for convenience in a vector3 class. i dont want accessor methods. i know python c

modifying a list while iterating through

2007-02-25 Thread dustin . getz
consider the following working loop where Packet is a subclass of list, with Packet.insert(index, iterable) inserting each item in iterable into Packet at consecutive indexes starting at index. i=0 while(ihttp://mail.python.org/mailman/listinfo/python-list

Re: modifying a list while iterating through

2007-02-26 Thread dustin . getz
On Feb 25, 9:15 pm, [EMAIL PROTECTED] wrote: > On Feb 25, 5:12 pm, [EMAIL PROTECTED] wrote: > > > consider the following working loop where Packet is a subclass of > > list, with Packet.insert(index, iterable) inserting each item in > > iterable into Packet at consecutive indexes starting at index.