Re: select.poll returning strange file descriptors.

2009-05-25 Thread Simon Wittber
Solved. I was using poll.register(fileno) without any flags specfied, which means "tell me when _anything_ happens". Because of this, I was receiving OOB data, which seems to use strange fileno values. to fix this, I now use this: poll.register(sock.fileno(), select.POLLIN|select.POLLOUT| selec

select.poll returning strange file descriptors.

2009-05-24 Thread Simon Wittber
I'm using the poll object from select.poll to check for events on sockets. It seems to work, however when I call .poll() on the poll objects, I sometimes get a fileno 1 returned, which is strange, because none of the sockets I registered with the poll object have a fileno of 1. In fact, the socket

One Python in a Pub, with 100 Rails Developers...

2007-08-16 Thread Simon Wittber
Python helped deliver the goods last Wednesday evening in front of a one hundred strong crowd of Rails hecklers... Video footage here: http://blog.scouta.com/2007/08/16/iccarus/ ...just kidding, they were all great chaps, and only a few were Rails devs, and only a few of them were hecklers :-) I

Re: Python Distilled

2006-11-06 Thread Simon Wittber
> http://www.python.org/dev/summary/2006-09-16_2006-09-30/#shrinking-python Excellent, just what I was hoping for. Thanks! -Sw. -- http://mail.python.org/mailman/listinfo/python-list

Python Distilled

2006-11-05 Thread Simon Wittber
I want to build a Python2.5 interpreter for an embedded system. I only have 4MB of RAM to play with, so I want to really minimise the python binary. Things I can think of removing safely are: - Unicode - Long numbers - Complex number - Compiler / Parser - Thread support - OS specific stuff

Generating unique row ID ints.

2006-10-01 Thread Simon Wittber
I'm building a web application using sqlalchemy in my db layer. Some of the tables require single integer primary keys which might be exposed in some parts of the web interface. If users can guess the next key in a sequence, it might be possible for them to 'game' or manipulate the system in unexp

Re: Help me use my Dual Core CPU!

2006-09-15 Thread Simon Wittber
Wolfgang Keller wrote: > > Are there any other concurrency options I've not discovered yet? > > PyMPI? > > Ironpython? > I'm looking at IronPython right now. I'm attempting to get it to run pybench, but first, I think I have to work out how to enable tracebacks... When the dual core notebook fina

Re: Help me use my Dual Core CPU!

2006-09-13 Thread Simon Wittber
Paul Boddie wrote: > Simon Wittber wrote: > > Michael wrote: > > > Also, Paul Boddie posted a module for parallel systems a while back as > > > well > > > which might be useful (at least for ideas): > > >* http://cheeseshop.python.org/pypi/paralle

Re: Help me use my Dual Core CPU!

2006-09-13 Thread Simon Wittber
Paul Rubin wrote: > "Simon Wittber" <[EMAIL PROTECTED]> writes: > > I've just noticed that os.fork is not available on Win32. Ouch. > > Use the subprocess module. I can't see how subprocess.Popen can replace a fork. Using a manually started pro

Re: Help me use my Dual Core CPU!

2006-09-12 Thread Simon Wittber
Michael wrote: > Also, Paul Boddie posted a module for parallel systems a while back as well > which might be useful (at least for ideas): >* http://cheeseshop.python.org/pypi/parallel > I've checked this out, it looks like a good idea which I could build further on. I've just noticed that os

Re: Help me use my Dual Core CPU!

2006-09-12 Thread Simon Wittber
Tim Golden wrote: > + Pyro - http://pyro.sf.net > + Corba - eg omniorb http://omniorb.sourceforge.net/ > + SPyRO - http://lsc.fie.umich.mx/~sadit/spyro/spyro.html > + mmap - (built-in module) http://docs.python.org/lib/module-mmap.html > + twisted - (because it can do everything), esp. > http://twi

Help me use my Dual Core CPU!

2006-09-12 Thread Simon Wittber
I've just bought a new notebook, which has a dual core CPU. I write cross platform games in Python, and I'd really like to be able to use this second core (on my machine, and on user's machines) for any new games I might write. I know threads won't help (in CPython at least) so I'm investigating

Re: How to write python plug-ins for your own python program?

2005-03-03 Thread Simon Wittber
> You mean like 'import'? :) That's how I would do it. It's the simplest thing, that works. exec("import %s as plugin" % pluginName) plugin.someMethod() where pluginName is the name of the python file, minus the ".py" extension. Sw. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyallegro status (is it dead?). What about pygame.

2005-02-27 Thread Simon Wittber
> How does pygame compare to pyallegro - both in maturity and convenience > of usage in python? I have not used pyallegro, and therefore cannot compare it to pygame. However, I can tell you that the pygame community is quite active and friendly. They're currently testing the pygame 1.7 release.

Re: accessor/mutator functions

2005-02-25 Thread Simon Wittber
> My questions are: > a) Are the three things above considered pythonic? Python uses a function called 'property to achieve the same effect. This example is taken from the documentation: class C(object): def __init__(self): self.__x = 0 def getx(self):

Re: web status display for long running program

2005-02-25 Thread Simon Wittber
> I was inspired to enhance your code, and perform a critical bug-fix. > Your code would not have sent large files out to dialup users, because > it assumed all data was sent on the 'send' command. I added code to > check for the number of bytes sent, and loop until it's all gone. Another solutio

Re: Threading and consuming output from processes

2005-02-24 Thread Simon Wittber
> 1) How should I solve this problem? I'm an experienced Java programmer > but new to Python, so my solution looks very Java-like (hence the use of > the threading module). Any advice on the right way to approach the > problem in Python would be useful. In the past, I have used the select module t

Re: pyrex just in time compilation

2005-02-21 Thread Simon Wittber
> Before I try this myself, has anyone else already written any code to do this? Yes, someone has. http://www.prescod.net/pyximport/ I should have googled more thoroughly before posting. :-) sw. -- http://mail.python.org/mailman/listinfo/python-list

pyrex just in time compilation

2005-02-21 Thread Simon Wittber
It occured to me that an import hook could be written for pyrex '.pyx' files, so that compilation can occur at runtime, if the source file has changed since the last compile. Before I try this myself, has anyone else already written any code to do this? Sw. -- http://mail.python.org/mailman/lis

Re: OT: why are LAMP sites slow?

2005-02-03 Thread Simon Wittber
> I notice that lots of the medium-largish sites (from hobbyist BBS's to > sites like Slashdot, Wikipedia, etc.) built using this approach are > painfully slow even using seriously powerful server hardware. Slow is such an ambiguous term. Do you mean the pages are slow to render in a browser, or

python memory blow out

2005-01-26 Thread Simon Wittber
I have written some software which proxy's SQL Server database services across a network. It uses Pyro, without multiuthreading. It creates and closes a new connection and cursor object for each request. Unfortunately, the memory consumption blows out (consuming all available memory) when a large

Re: why are people still using classic classes?

2005-01-13 Thread Simon Wittber
> Unfortunately, if we should follow the recent advice about > always using "super()" in the __init__ method, it's hard > to do what you suggest (though it sounds like good advice) > without resorting to extreme ugliness: 'import this' also provides some good advice: "There should be one-- and pr

Re: why are people still using classic classes?

2005-01-12 Thread Simon Wittber
> Is there a reason NOT to use them? If a classic class works fine, what > incentive is there to switch to new style classes? Perhaps classic classes will eventually disappear? It seems strange (and is difficult to explain to my peers) that a language offers two different ways to define a stand

why are people still using classic classes?

2005-01-12 Thread Simon Wittber
I've noticed that a few ASPN cookbook recipes, which are recent additions, use classic classes. I've also noticed classic classes are used in many places in the standard library. I've been using new-style classes since Python 2.2, and am suprised people are still using the classic classes. Is th

Re: Game programming in Python

2005-01-11 Thread Simon Wittber
> I'm looking for any books or on-line resources on game programming > using Python. Does anyone have any advice? Hi Baza, If I you are as I assume, a programmer just starting out with game programming, the best suggestion I can give is head over to pygame.org, and after downloading and installi

Re: sql server support from linux

2004-12-23 Thread Simon Wittber
> I considered doing exactly the same thing a while ago, but was worried > about running into an annoyance like that. FWIW, The synchronous Pyro server performed much faster than the multithreaded version, even under heavy use from 3 machines. It appeared that while the database queries were se

Re: sql server support from linux

2004-12-21 Thread Simon Wittber
> If you can get the DB-API wrappers running on Win2k, how about doing that > locally and then > writing a quickie socket server which your linux client can connect to? That is, essentially, exactly what I have done. I've exposed the DB API using Pyro. I had to turn multithreading off, as the se

sql server support from linux

2004-12-20 Thread Simon Wittber
I am currently tasked with connecting Python CGI programs, under Apache2 / Linux, to SQL Server on Windows 2000. The latest MSSQL module from http://www.object-craft.com.au/projects/mssql/ (0.09) will not (for me, at least) compile on Debian. The next version of the module (0.08) will compile, but

Re: atmosphere on c.l.py (WAS: How about "pure virtual methods"?)

2004-12-19 Thread Simon Wittber
> I do understand the feeling though; Fredrik Lundh jumped at me only a > few days ago when I said that I personally found list comprehensions > more readable than map. I certainly don't mind being advised or > corrected if I've written incorrect or even just suboptimal code, but > attacking a per

Re: Performance (pystone) of python 2.4 lower then python 2.3 ???

2004-12-13 Thread Simon Wittber
> Which shows a decrease in performance. Could this have anything to do with the > fact that is is a dual processor box? Doubtful. I'm running dual Pentium 4 2.8 Ghz (Win XP) and get the following results: C:\>python23\python Python23\lib\test\pystone.py Pystone(1.1) time for 5 passes = 1.430

Re: creating generators from function

2004-12-08 Thread Simon Wittber
> A function containing an infinite loop will never return, so it is bugged > and useless unless it does has an external effect with something like > 'print xxx' within the loop. I thought the idiom: while True: #code which iterates my simulation if condition: break wat quite normal. T

Re: creating generators from function

2004-12-08 Thread Simon Wittber
> I'm a little confused as to what you're trying to do here. The f() > function, in particular, doesn't make much sense I see I am misunderstood. The example was contrived, and it seems, incorrect. I simulate threads, using generator functions and a scheduler. My implementation lives here: http

creating generators from function

2004-12-08 Thread Simon Wittber
I use a coroutine/generator framework for simulating concurrent processes. To do this, I write all my functions using the general form: while True: do stuff yield None To make these generator functions compatible with a standard thread interface, I attempted to write a decorator which co