Re: A list with periodic boundary conditions

2009-05-26 Thread youh...@googlemail.com
Rodhri, thank you very much for your reply. I've tried to extend what you suggested; I think it can be made to work, but you're right -- it gets horrid rapidly. I'm at the start of what promises to be a large project, and I want to make sure that I get my data structures right, but my impression

Re: A list with periodic boundary conditions

2009-05-21 Thread Rhodri James
On Thu, 21 May 2009 13:08:39 +0100, wrote: Hi, I'm trying to create a new class of list that has periodic boundary conditions. Here's what I have so far: class wrappedList(list): def __getitem__(self, p): return list.__getitem__(self, p%len(self)) def __setitem__(self, p, v):

A list with periodic boundary conditions

2009-05-21 Thread youhvee
Hi, I'm trying to create a new class of list that has periodic boundary conditions. Here's what I have so far: class wrappedList(list): def __getitem__(self, p): return list.__getitem__(self, p%len(self)) def __setitem__(self, p, v): list.__setitem__(self, p%len(self), v)