ThreadingTCPServer: sock.recv() doesn't block?

2008-04-02 Thread Prepscius, Colin (IT)
So I'm using the ThreadingTCPServer from the python standard library SocketServer, and calling serve_forever on it. In my handler's handle method, I call self.request.recv(x) in a loop until I've received n bytes. But recv() returns immediately with nothing, over and over. It all still works, bu

Creating a cell 'by hand'

2007-11-08 Thread Prepscius, Colin (IT)
The last argument to new.function takes a closure, which is a tuple of cell objects. Does anybody know how to create those cell objects 'by hand'? Thanks! Colin NOTICE: If received in error, please destroy and notify sender. Sender does no

RE: exec and func_code

2007-07-24 Thread Prepscius, Colin (IT)
ECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Carsten Haese Sent: Tuesday, July 24, 2007 1:39 PM To: python-list@python.org Subject: Re: exec and func_code On Tue, 2007-07-24 at 13:24 -0400, Prepscius, Colin (IT) wrote: > Does anybody know how to pass parameters to 'exec > somefu

exec and func_code

2007-07-24 Thread Prepscius, Colin (IT)
Does anybody know how to pass parameters to 'exec somefunction.func_code'? def f1(): print 'this is f1' def f2(p): print 'this is f2, p =', str(p) exec f1.func_code THIS RESULTS IN: "this is nf1" WHICH IS NICE exec f2.func_code THIS RESULTS IN: TypeError: f2() takes exactly 1 ar

exec and CodeObjects

2007-07-20 Thread Prepscius, Colin (IT)
Does anybody know how to pass parameters to 'exec somefunction.func_code'? def f1(): print 'this is f1' def f2(p): print 'this is f2, p =', str(p) exec f1.func_code THIS RESULTS IN: "this is nf1" WHICH IS NICE exec f2.func_code THIS RESULTS IN: TypeError: f2() takes exactly 1 ar