Python is absurd.
Yes, yes it is. *Muahaha*
Sorry for the outage, but I’ve not been using categories for quite some time because of space issues.
My web provider recently gave me more storage, so I’ll be posting to categories again.
Enjoy.
This morning I wrote up a quick tutorial on producing XML with Python. There seems to be many resources on parsing XML in Python, but very few articles/howtos on actually creating it. Here’s the sample code from the first part of this hopefully multipart tutorial:
from xml.dom.minidom import Document
# Create the minidom document
doc = Document()
# Create the <wml> base element
wml = doc.createElement(“wml”)
doc.appendChild(wml)
# Create the main <card> element
maincard = doc.createElement(“card”)
maincard.setAttribute(“id”, “main”)
wml.appendChild(maincard)
# Create a <p> element
paragraph1 = doc.createElement(“p”)
maincard.appendChild(paragraph1)
# Give the <p> elemenet some text
ptext = doc.createTextNode(“This is a test!”)
paragraph1.appendChild(ptext)
# Print our newly created XML
print doc.toprettyxml(indent=” “)
You can find the output of this program and some links in the article. Murphy willing, more will follow.
Update: The code listing should be fixed.
Coil is an MVC framework for Python. It is based largely on the ideas and design of Struts and allows you to cleanly separate models, views, and controllers via an XML configuration file. A very basic login example that demonstrates the basic work flow is included.
Here’s what’s new in 0.3:
This version features Cheetah support for the “view”, form objects with validation support, action objects for controller abstraction, DispatchAction support that allows multiple method entry points on the same action object, and ActionForward for abstracting a page location by name.
This is definately worth checking out!
The Python Package Index makes note of pyDes 1.0, a pure python implementation of both DES and Triple DES. The pyDes homepage is here.
As my wife wrote, we have been looking at Python as a programming language, together. I think it took some time for her to digest lack of semi-colons and the notion of meaningful indentation (just like how I felt when I saw Python first), but she now strongly believes that this is the language one should use to teach programming. Amen.
Here’s something that struck me as oh so true:
…pseudo code works…
Ain’t that grand?
Alex Martelli covers some new stuff that will be in Python 2.3. It’s much more readable than the changelogs. It looks like 2.3 is going to include some overall speedups as well as introduce a few cool new things. If you’re a python head, this article is definatley a worthwhile read.
David Mertz investigates polymorphism in Python with multimethods:
Object-oriented programming gains much of its versatility through polymorphism: objects of different kinds can behave in similar ways, given the right contexts. But most OOP programming is single dispatch; that is, just one designated object determines which code path is taken. Conceptually, a more general technique is to allow all the arguments to a function/method to determine its specialization. This article presents an implementation of multiple dispatch in Python, and shows examples where this makes for better programs.
Rael:
Here’s an utterly naughty little something not for the faint-of-heart… inline_python is a stub plug-in for anyone wishing to try their hand at writing Blosxom plug-ins in Python. A hearty “yeehaw!” to the creator of the first Python Blosxom plug-in. ;-]
Truly evil stuff. <evil grin>
I think that this might open the floodgates for more robust Blosxom plugins.
I love Python. I really love Python. I’m working on a little project that should really obey robots.txt
. I hit up google to see if there was any code out there for me to take a look at or if I was going to have to write a little code to handle robots.txt.
Of course, one of the first things that I stumbled upon was robotparser, a module that does just that.
Instead of reinventing the wheel, all I have to do is import robotparser
and use the code that has already been written for me. Python’s Standard Library absolutely rules.
LWN‘s posting of this week’s Dr. Dobb’s Python-URL contains linkage to the Eric3 Python IDE. It looks really nice and is built upon PyQT and QScintilla. The screenshots are impressive, I’ll try to check it out.
There are some notable updates at the Python Package Index:
Mostly to get a feel for what development with wxWindows is like, I mocked up a three paned aggregator using ActivePython, wxPython, and Mark’s ultra-liberal RSS parser.
Very cool, worth looking into indeed. What if the killer aggregator isn’t three paned? NetNewsWire looks really easy to use, although I’ve never had a chance to use it (8500 with a G4 card doesn’t like OSX). I like my one paned aggregator for reading up over the web, though I keep thinking that there must be a better solution to the problem lurking out there somewhere.
Python Packages Index, a sanctioned listing of Python packages is online now.
Where can I get the recent updates RSS feed?
Update:
Josh, a.k.a. nf0, and Richard both note that an RSS feed was in front of my face. The ultimate lazyweb in action, I didn’t even have to send a trackback to the lazyweb. Needless to say, I’m subscribed now.
The list of speakers at PyCon DC 2003 has been posted to the PyCon Wiki.
I’ll be registering when I get paid on Friday.
I have seen some stir recently about implementing a CPAN work-alike for Python. I think that Python doesn’t really need a CPAN. First off, take a look at the Python Standard Library. There have been several instances where I was looking for some python code to do something, say parse a url string into several parts. Guess what? Python has a built-in module called urlparse that does it for you.
Sure, there are things that the Python Standard Library can’t do. For that, distutils makes it really easy to distribute and install Python packages or modules. All the end user should have to do is python setup.py install
. Most of the time, required libraries or modules will be included or linked to on the web or in the docs. It’s true that with distutils you don’t have a way to travel down the dependency tree to install things in the order neccesary, but with all the goodies in the Standard Library and distutils, that’s not usually an issue.
I have a feeling that a CPAN workalike would duplicate a ton of work that has already been done in the Python community. It probably also won’t help all that much.
Also, many of the modules that you might use to argue the neccesity of a CPAN-like archive should alternatively be folded in to the Python Standard Library. They’d probably be a lot more useful there.
I have a feeling that there might be some discussion about this at PyCon DC, as I think someone mentioned it on the PyCon Wiki at some point. Just a quick thought/pseudorant.
I’m working on a python library/script to convert an rss file to a browsable wml file. Right now it can be used as a library and run from a cron job, though I’ll release a cgi example at some point too. No source code for you yet, it’s still too ugly. Here’s a picture of my cel phone browsing the WML of my RSS feed before this post:
It’s not clickable or really functional yet, but right now you can see a list of titles from my RSS feed at the time I ran the script. It uses Mark’s RSS parser, which does all of the heavy lifting as always.
Expect more over the weekend (read: sunday).
Boudewijn Rempt and David Mertz at IBM developerWorks look at Qt and PyQt:
The Qt toolkit is a widely-used cross-platform GUI toolkit, available for Windows, Linux, Mac OSX, and handheld platforms. QT has a well-structured, but flexible, object-oriented organization, clear documentation, and an intuitive API. In this article, David Mertz and Boudewijn Rempt look at the Qt library, with a focus on the PyQt bindings that let Python programmers access Qt functionality.
openMosixWebView is a PHP script for monitoring an openMosix cluster via the Web. It produces Web charts and useful info tables. It uses openMosixview’s openMosixCollector logs and openMosix metainfo.
The screenshots look pretty slick, similar to some php-based network traffic graphing programs that I’ve seen.
PyMT:
PyMT is a Python module for easy access to Movable Type’s xml-rpc API. This allows you to build desktop or Web applications for managing your MT weblogs without using the MT administrative interface.
Cool. Another type of glue for Python.
Zope Corporation announced the release of Zope 2.6.1, the latest version of the award-winning open source application server. The new release represents the successful global collaboration of community developers, as it is the first to contain a majority of enhancements from the Zope community.