April 10, 2009 – 12:46 pm
There’s a bit of buzz on the python-ideas mailing list about Greg Ewing’s proposal for a new keyword “yield from“. He has made a draft PEP and patch for python 2.6.1.
On short it adds syntactic sugar for generator decomposition and adds a “return value” statement in generators (the underlying mechanism for that is a StopIteration(value) [...]
January 19, 2009 – 12:56 am
I was playing these days with greenlets and I finally managed to find some time to make and coroutine implementation for cogen that uses the seamless stack switching of greenlets instead of the usual generator yield-based switching.
The best part about this is that cogen could support any sort of old code that uses the usual [...]
November 29, 2008 – 1:45 am
I’ve finally mannaged to pull off a set of wrappers for using the raw windows iocp api using ctypes, namely wrappers for GetQueuedCompletionStatus, WSARecv, WSASend, AcceptEx, ConnectEx, TransmitFile and the whatever structs and utility calls they need.
Writing the wrappers wasn’t that hard – but if you aren’t careful with ctypes you are in a world [...]
November 3, 2008 – 10:36 pm
It’s interesting that having “dev” version packages in the install_requires list will fail.
Say for example, if you do:
from setuptools import setup
setup(
…
install_requires=["Pylons==dev"],
…
)
It won’t work:
Installed d:\python25\lib\site-packages\pylons-0.9.7rc3dev_20081103-py2.5.egg
Reading http://www.pylonshq.com/download/0.9.7
error: Could not find required distribution Pylons==dev
I imagine it would match if the package would literally have the version “dev”.
One solution is to change the install_requires to ["Pylons==dev,!=foo"] or some other [...]
October 26, 2008 – 12:51 am
I didn’t knew that till i’ve read Ian’s post on decora-descriptors (I guess I can call them that). Actually it’s explained in more details here.
On short, functions have the __get__ method that make them work as descriptors when they are in a class.
I can do this:
>>> class Bar:
… pass
…
>>> bar = [...]
September 23, 2008 – 1:34 am
Quitter’s journal: After trying for half of week of getting some stuff going on appengine here is what I observed.
The runtime is completely different. They do try however to patch the normal python runtime in the sdk to have the same characteristics as the runtime on their servers but differences fall through the cracks. The [...]
September 15, 2008 – 8:03 am
The major refactor of the socket stuff is finally in the trunk. The Socket is more in line with the standard socket module in python (there’s a makefile and a _fileobject for readline just like the standard library). And it looks like performance is still pretty good.
The only things I can think of right now [...]
There is something very cool about wsgi: asynchronicity at it’s core ! The spec was made with this in mind – I absolutely love wsgi.
I’ve been playing recently with pylons and i’ve made a example chat app – just a proof-of-concept comet application with long pooling in a pylons app using a custom wsgi server [...]
Looks like using setuptools’s test runner (eg, run python setup.py test) with the nose.collector has some weird issues – well, unexpected, for me at least.
I was using nose with coverage via –with-coverage option to get some cover reports. But setup.py test borked with “setup.py: error: no such option: –cover-package”. After some digging in the sources [...]
April 20, 2008 – 11:06 am
I’ve implemented a reactor to integrate the cogen loop in the qt main loop.
You whould use it like this:
from PyQt4 import QtGui
app = QtGui.QApplication([])
hello = QtGui.QPushButton( "Hello world!" )
hello.resize(100, 30)
hello.show()
from cogen.core import reactors, schedulers
m = schedulers.Scheduler(reactor=reactors.QtReactor)
def lorem_ipsum_app(environ, start_response):
start_response(‘200 OK’, [('Content-type','text/plain'), ('Content-Length','19')])
return ['Lorem ipsum dolor..']
server = wsgi.WSGIServer(
[...]