Python Programming, news on the Voidspace Python Projects and all things techie.

More Python Stuff & Money

emoticon:mobile_world Another random collection. Hopefully coherence will be restored shortly Question

I just bought a laptop. It's an IBM Thinkpad T30 [1], so nothing very new but good enough for commuting.

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. Wink

[1]2GHz and 512mb RAM, blah blah.

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-08-04 13:54:04 | |

Categories: , ,

Big Number Maths

emoticon:speaker If you have to do maths with really big numbers, which data-type do you choose ? Integers, floats or even the new-fangled decimals [1] ?

There's another 'debate' raging on Python-Dev about floating point maths. Ronald Oussoren just posted this example :

>>> v = 1e200
>>> int(v)
>>> type(v)
<type 'float'>
>>> t = int(v)
>>> t ** 2
>>> 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. Smile

[1]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...

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-08-03 21:59:31 | |

Categories: ,

Continuous Integration, Performance & Ruby on Rails

emoticon:car 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. Smile

At Resolver Systems we run continuous integration (using Cruise Control .NET). If you check in anything that breaks the build, we all know about it within fifteen minutes [1].

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 [2] :

Resolver Performance Data

It's nice to see Ruby in action, the AJAX (think column sorting and data editing) is a nice touch. Smile

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.

[1]Actually, running all our unit tests and functional tests now takes a bit longer than fifteen minutes.
[2]Bonus points for knowing where the computer names are taken from...

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-08-02 22:01:47 | |

Categories: ,

Not Invented Here

emoticon:contour 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. Smile

  1. Bruno Thoorens: Python Projects

    This contains two projects of note. The first is a GUI front end to py2exe.

    It provides a convenient way of creating Python executables without having to configure the 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. Razz

    The other package of note from Bruno's site, is a wrapper around the Tk Tile Extension. It includes a binary for windows which isn't available from the Tile Project Page [1].

    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.

  2. Mark Rees on Iron Python

    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.

  3. PyCaml

    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 :

  • Stiff asks, great programmers answer

    Great programmers answer questions about programming. Guido just can't take it seriously, very amusing. (The other answers are more informative though...)

  • Let's Build A Compiler For The CLR

    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).

  • When the "best tool for the job" isn't...

    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.

  • Heat Wave

    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. Smile

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.

[1]Although you can obtain it by downloading Active Tcl.

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-08-02 21:03:18 | |


News from Several Flavours of Python

emoticon:pencil Recent news from several of the different flavours of Python that exist :

  • CPython 2.5

    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.

    Barry Warsaw has just completed porting MailMan to Python 2.5. He didn't have many difficulties, but different applications will find different parts of the changes effect them.

    I even made my own small contribution to Python 2.5. Even though Thomas Heller provided the patch for the bug I reported, I did provide a patch for which tests the copytree function. Smile

  • IronPython 2.5

    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:

    1. PEP 308: Conditional Expressions

    2. PEP 343: The 'with' statement. (as per PEP 343, you need to do ‘from _future_ import with_statement’ for enabling ‘with’ statement )

    3. Other Language Changes

      1. The dict type has a new hook for letting subclasses provide a default value with ‘_missing_’ method.
      2. Both 8-bit and Unicode strings have new partition(sep) and rpartition(sep) methods.
      3. The startswith() and endswith() methods of string types now accept tuples of strings to check for.
      4. The min() and max() built-in functions gained a ‘key’ keyword parameter.
      5. Two new built-in functions, any() and all(), evaluate whether an iterator contains any true or false values.
      6. 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.

    He's got SSL Working and shows how to use the ctypes code generator to create wrappers for libraries (like OpenSSL in this example).

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-07-30 23:03:26 | |

Categories: ,

Zope 3 & Movable Python

emoticon:car A Movable Python user JimC has got Zope 3 working with Movable Python.

  1. Copy over all the modules listed in c:\python24\Zope-wininst.log.

  2. Movpy 2.4 includes a version of the pytz module, but it's incompatible with Zope [1] (doesn't include the UTC singleton), so you need to copy over a new one and prepend its location to sys.path.

  3. The mkzopeinstance script boils down to:

    from import main
  4. 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.

  5. 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.

[1]I guess I should sort this out...

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-07-29 14:10:48 | |

Categories: ,

IronPython & Windows Forms VIII


This article has moved.

You can find the whole tutorial series at IronPython & Windows Forms.

Like this post? Digg it or it.

Posted by Fuzzyman on 2006-07-29 03:11:59 | |

Categories: , ,

Hosted by Webfaction