Python Programming, news on the Voidspace Python Projects and all things techie.
More Python Stuff & Money
Another random collection. Hopefully coherence will be restored shortly
- Python 2.5 Beta 3 is out and about
- Mark Rees has completed part II of his tutorial on Programming with IronPython and GDATA
- I hope I can find a use for Crunchy. Crunchy is a way of creating fully interactive tutorials with Firefox. See Crunchy Frog News for the low-down
- It looks like the defining feature for Clever Harold, the latest member of the Python-web-framework family, is that it is a full WSGI stack. Wait a minute, isn't that what Pylons is ?
On the subject of commuting, this has been my week for spending money. I just bought an annual season ticket for Northampton to London. A mere £4324... If you want to work in London, don't live in Northampton. So why don't I move ? No way, if you want to work in London, don't live in London either.
|||2GHz and 512mb RAM, blah blah.|
Big Number Maths
There's another 'debate' raging on Python-Dev about floating point maths. Ronald Oussoren just posted this example :
>>> v = 1e200 >>> int(v) 999999999999999969733122212510361659474503275455023626482417509503468484355 540755341963384047062518680275124159738824081821357343682784846393850410472 39877871023591066789981811181813306167128854888448L >>> type(v) <type 'float'> >>> t = int(v) >>> t ** 2 999999999999999939466244425020724235032897553743712247233978162062705420868 772363027380308001932133054230558394675289323324880702327952854432161552216 024892912466614409626956153314556116473848998339762109232220813863099472521 374735119038509661875525607726747258646821773646868361139842288412173261267 039669530389442594522433115448347796339690544576171593343952002082284333711 4038314499908946523848704L >>> float(t**2) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: long int too large to convert to float
Of course I knew that Python long integers were unbounded, but this is just silly.
|||Which I'm convinced are the way forward in lots of situations and I'm really looking forward to the C implementation. I'd also like to see language syntax for them. Maybe 112.375D...|
Continuous Integration, Performance & Ruby on Rails
How long would it take to create a simple (and useful) AJAX application using Ruby on Rails ? How about a lunch break...
This is a short story, but I'll try to draw it out as much as possible.
One of our early user stories was a performance related one. A standard set of operations is done on a moderately complex dataset. If it takes more than a second, then the test fails (and the build is broken). This has caught a few times when changes affected performance.
Sometimes the degradation happens slowly, over a few checkins. It can be difficult to work out exactly which change made the difference.
Over lunch break today Andrzej (who is now an accomplished Python programmer, but used to do web-development with Ruby on Rails), changed the user story to put the results into a database with the revision number and the machine they run on.
One small application later, and we can view the performance of Resolver as it changes with code revisions  :
It's nice to see Ruby in action, the AJAX (think column sorting and data editing) is a nice touch.
An interesting point is that the sort of meta-programming that Ruby makes easy, means that Andrzej (like a lot of Ruby programmers) feels that he is more of a Rails programmer than a Ruby programmer.
I guess this is a double edged sword for a language, however at least in terms of the hype-war, Rails is kicking Python's butt when it comes to web-dev.
|||Actually, running all our unit tests and functional tests now takes a bit longer than fifteen minutes.|
|||Bonus points for knowing where the computer names are taken from...|
Not Invented Here
Here are some projects I've stumbled across recently that you might find interesting. The first is useful, the second promising, and the third weird.
It provides a convenient way of creating Python executables without having to configure the setup.py yourself. Very nifty.
Now what would be even nicer (why hasn't someone done this already ?), would be to create a front end to distutils itself, including all its arcane (and undocumented) jiggery pokery like package_path and extra_dir.
Tile is a themeing engine for Tk which brings a much nicer (native) appearance to GUIs created with Tkinter. It will be a standard part of Tk 8.5, but currently exists as a separate project. Unfortunately it uses a completely different syntax to standard Tk widgets for styling, so a Python wrapper is very welcome.
Mark Rees has just started a competing^H^H^H^H^H alternative series of tutorials on programming with IronPython. This is just the first entry, but it looks very promising.
He promises to cover a different set of topics to the ones I have planned, so I'm looking forward to it.
This is weird, but in a cool kind of way. Now OCaml programmers can take advantage of some of the awesome Python extension modules written in C.
It claims to have implemented the Python C-API for OCaml, presumably doing type conversion between Python C objects and OCaml types. Far out...
Whilst I'm linking to other people's stuff, here are some more :
Great programmers answer questions about programming. Guido just can't take it seriously, very amusing. (The other answers are more informative though...)
Raj has finally got his own website. This is the new location for his excellent tutorial on writing compilers for the Common Language Runtime (the .NET framework).
A thought provoking blog entry about why "The Best Tool for the Job" might not always be the best tool for the job... Challenging a programmer's truism, by the ever interesting Creating Passionate Users.
Finally one that has nothing to do with programming. This is highly topical, very funny and totally politically incorrect. Scott Adams solves the middle eastern crisis by the judicious application of air conditioning.
Oh, and by the way, The Trunk Freeze for Python 2.5 Beta 3 has just happened. There will probably be a release candidate out about August 18th. The final release will follow on its heels on September 12th or thereabouts. As if that wasn't enough, there is another Python web framework surfacing: Clever Harold. Good name, but God knows what it's for.
|||Although you can obtain it by downloading Active Tcl.|
News from Several Flavours of Python
Recent news from several of the different flavours of Python that exist :
The release schedule for Python 2.5 is slightly delayed. It looks like we will have a third beta, and the final release a bit later than expected.
This is mainly because Python 2.5 has lots of changes, particularly in the C API to support 64 bit platforms, so more testing is needed.
I missed this news with the release of IronPython 1.0 RC1, mainly because my email client marked the announcement as spam.
Not content with implementing Python 2.4, the IronPython team have started on Python 2.5.
In addition RC1 has several new 2.5 Python features that can be enabled with the experimental switch â€“X:Python25, but by default these are disabled:
PEP 308: Conditional Expressions
PEP 343: The 'with' statement. (as per PEP 343, you need to do â€˜from _future_ import with_statementâ€™ for enabling â€˜withâ€™ statement )
Other Language Changes
- The dict type has a new hook for letting subclasses provide a default value with â€˜_missing_â€™ method.
- Both 8-bit and Unicode strings have new partition(sep) and rpartition(sep) methods.
- The startswith() and endswith() methods of string types now accept tuples of strings to check for.
- The min() and max() built-in functions gained a â€˜keyâ€™ keyword parameter.
- Two new built-in functions, any() and all(), evaluate whether an iterator contains any true or false values.
- The list of base classes in a class definition can now be empty.
wxPython for PythonCE
Ingmar Steen has announced the first release of his port of wxPython for PythonCE. PythonCE runs on PocketPC and Windows Mobile devices.
From the screenshots it looks very cool.
Luke Dunstan has also made some progress porting Python 2.5 to the PocketPC platform.
PyPy & ctypes
Lawrence Oluyede has been working on porting CPython extensions for PyPy, using ctypes.
Zope 3 & Movable Python
Copy over all the modules listed in c:\python24\Zope-wininst.log.
The mkzopeinstance script boils down to:import zope.app.server
from zope.app.server.mkzopeinstance import main
The absolute path to the instance directory gets hard-coded into the instance files all over the place, so you have to go through and replace it with movpy-relative paths in all the scripts. The .bat files are more of a pain, I just got rid of them.
The absolute path also gets hard-coded into the zope.conf file. I expect there's a way to override that from the command line, I just modified the runzope script to over-write the file from a template each time it's run.
Movable Python can be obtained from Movpy on Tradebit.
There is a free trial version for Python 2.3 at Movpy Demo Version.
|||I guess I should sort this out...|
IronPython & Windows Forms VIII
This article has moved.
You can find the whole tutorial series at IronPython & Windows Forms.
This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License.