Posts

"raise" becomming a function in py3k?

Over on the voidspace blog, there is a little discussion about raising an exception in a lambda. Because raise is a statement, it's kind of a hard thing to do. Raising an exception as an expression that is. Which "raises" the question, why isn't raise a function in py3k? The two suggestions on how to raise in an expression were these: >>> r = lambda: eval(compile("raise RuntimeError", '', 'exec')) >>> r() >>> ctypes.pythonapi.PyErr_SetObject(*map(ctypes.py_object, (e.__class__, e))) Which are kind of both a bit yuk. So maybe raise could be a bit more expressive in py3k?

Bars in Beijing?

A friend of mine who lives in Beijing has set up a website categorising all the Bars in Beijing . It's still a work in progress, but he has listed over 500 bars so far. For a place as big as Beijing, you can imagine that there's going to be a lot of bars. They're categorised by location, and if they are a night club, a bar, or a KTV(karaoke) place etc. He still wants to add photos for all of the bars, and just generally make it a nice guide to Beijing bars .

Ludumdare 48h game development competition this weekend.

Image
For those that didn't have time for pyweek (like me) - there is the ludumdare game development competition. The ludumdare competition is similar to pyweek - it's what inspired pyweek. The main differences are it's more "from scratch", it is only one weekend, and you have to do everything yourself - no teams. Also you can use any language - not just python, and everyone can select themes over three voting rounds. The main idea is that One has to do all parts of game development - art, coding, sound, music etc, and to concentrate on the design of the game - rather than building engines. So it's a short burst of creativity, and junk food eating - with around 100 other people at the same time making their own games. (img by MrFun ). LD 11 :: Weekend of April 18-20 - Currently doing round 2 of theme voting.

database ORM adaptors?

Are there any adaptors for the various python database ORM models? For example SQLObject Storm mother ORM django ORM SQLAlchemy GeniusSQL, etc. It seems this might be a good way to reuse some models, and code for those models. For example, say there was a SQLAlchemy Django ORM adaptor, then pylons, django, and turbogears could more easily inter operate. Then if an adaptor for SQLObject SQLAlchemy was made SQLObject could then use the SQLAlchemy django ORM adaptor. I guess at this point, sharing at the database level makes more sense. update : http://code.google.com/p/django-sqlalchemy/ seems to be a work-in-progress "project to create SQLAlchemy mapping of Django models onto a SQLAlchemy backend".

Being proactive with bugs - search, not categorise.

I like to search for bugs, not so much wait for them to be reported in one specific way. Here's a story to illustrate what I mean. As part of a new pygame release we've been improving the pygame bug reporting, and fixing system. The old(and current) system used the mailing list as a bug reporting system . We still use this system, but have added a few other methods. People simply report bugs and patches to the mailing list. Then developers search through the mailing list, and noted when they were fixed, on the mailing list. Because the pygame mailing list is quite large often a lot of people would view, review and fix the bugs. It also informs people how to report a bug - because people on the mailing list see it happening every now and then. Having bugs in the mailing list is nice, because I can type BUG into my mail programs search function to find bugs. Or I can type PATCH to find patches. Or I can have my program filter emails with bug, patch from specific mailing l...

hi, what is it? oh pygame 1.8 is released.

Dear you, I was walking down the street the other day and pygame 1.8 was accidentally released. oops. Well anyway. Have a nice day. http://pygame.org/whatsnew .shtml http://pygame.org/ * pygame.mask for pixel perfect collision detection * pygame.scrap for clipboard support * new and improved sprite groups, including layers, automatically selecting fastest update mode(full screen or dirty rect updates), and blend modes... * blending support for filling and blitting surfaces. ADD, SUB, MULT, DIV etc. * saving surfaces as jpeg and png * buffer access for Surface and Sound objects * numpy, and numeric support for pygame.surfarray and pygame.pixelarray * PixelArray, which can be used instead of numpy - without the dependency. * smooth scale function written in mmx assembly with C fallback. * More functions release the GIL for multithreaded use. * lots of speed ups to many functions via better python wrapping. * color thresholding, bounding box finding for images, and surface aver...

py3k Decimal?

From the Cobra language, comes the idea of using Decimal numbers as the default. It's 2008, so let's use decimals by default! This is an error that python has... Add 0.1 together ten times, and you do not get 1.0. >>> 1.0 == 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 + 0.1 False Maybe py3k should use Decimals by default instead? Or is this planned already? Python float performance is really bad anyway, so we might as well make it a little more accurate right? Floats are such a cause of errors in code, it'd be nice if math was more accurate by default :) It requires a fair bit of knowledge to understand all the quirks of floats, but less to understand the quirks of decimals. cu.