curses problem reading cursor keys

2006-10-07 Thread Simon Morgan
Hi, I'm having trouble with the following code. The problem is that the value read by getch() when I hit the up or down keys doesn't match curses.KEY_UP or curses.KEY_DOWN respectively. Other keys, such as 'z' in my example code, work fine. I only seem to have this problem when dealing with

Re: curses problem reading cursor keys

2006-10-07 Thread Simon Morgan
On Sat, 07 Oct 2006 13:12:33 +, Simon Morgan wrote: import curses def main(scr): status = curses.newwin(1, curses.COLS, 0, 0) status.bkgd('0') status.refresh() list = curses.newwin(curses.LINES, curses.COLS, 1, 0) list.bkgd('X') list.refresh() If I use scr.subwin

Re: constructor list slice confusion

2005-07-14 Thread Simon Morgan
On Thu, 14 Jul 2005 08:38:36 +0200, Peter Otten wrote: Maybe, after a little renaming you can see it yourself: class SomeClass: def __init__(self, default_contents=[]): # make a copy of default_contents that is # kept in a SomeClass instance self.contents =

constructor list slice confusion

2005-07-13 Thread Simon Morgan
Hi, Can somebody please explain to me why: class SomeClass: def __init__(self, contents=[]): self.contents = contents[:] def add(self, element): self.contents.append(element) when called a second time (i.e. to create a new instance of a SomeClass object) results in