python extended slicing
Greg Landrum
glandrum at my-deja.com
Wed Jul 19 20:17:48 EDT 2000
I'm looking to implement a class which should behave like a 2D array,
so I'd like to be able to use extended slicing to make this go.
i.e. I'd like to be able to do:
result = myInstance[0:-1,3:-1]
and the like and have it behave nicely.
I have figured out how to do this in __getitem__ and __setitem__,
but the code ends up being awfully long and non-pythonic (well, it
looks non-pythonic to me).
I was wondering if anyone knowns of an example of some good
__getitem__/__setitem__ code lying around that I could take a look
at.
thanks!
-greg
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list