MPY (MPi for pYthon)
Grok Headline matches for MPY (MPi for pYthon)
Python and XML: XML Namespaces Support
in Python Tools, Part Two
Python and XML: XML Namespaces Support
in Python Tools, Part Two
05/13/2004 07:55 PMIn his latest Python and XML column, Uche Ogbuji continues his tour of
XML namespaces support in Python tools, focusing this time on 4Suite.
Python and XML: XML Namespaces Support
in Python Tools, Part Three
Python and XML: XML Namespaces Support
in Python Tools, Part Three
06/30/2004 07:31 PMIn this month's Python and XML column Uche Ogbuji examines the
namespace support in ElementTree, PyRXPU, and libxml.
Backporting from Python 2.3 to Python
2.2
Backporting from Python 2.3 to Python
2.2
06/08/2004 11:18 PMWe have a home-grown templating system at work, which I
intend to dedicate an entry to some time in the future. We originally
wrote it in Python 2.2, but upgraded to Python 2.3 a while ago and
have since been evolving our code in that environment. Today I found a
need to load the most recent version of our templating system on to a
small, long neglected application that had been running the original
version ever since it had enough features to be usable.
Unfortunately, this application was running on a server
that only had Python 2.2. Installing Python 2.3 would have been
somewhat more painful here than on other servers we run for reasons I
won't go in to, so I decided to have a go at getting our current code
to run under the older Python version.
In the end, I only had to make three minor changes, all at
the top of the file in question.
I added from __future__ import
generators as the very first line of the file. We use
generators (with the yield statement) in a
few places - this feature was only properly added in Python 2.3, but
was made available in Python 2.2 as a "future enhancement" through the
aforementioned obscure import.
I added True, False = 1,
0 on the next line down. Surprisingly, Python 2.2 had no
support for a boolean type and instead used a test for non-zero
instead. The above line defines constants that behave enough like
Python 2.3's True and False to avoid any problems.
I defined an enumerate
function, which was introduced for real in Python 2.3. Here's the code
I used:
def enumerate(obj):
for i, item in zip(range(len(obj)), obj):
yield i, item
All in all it only took around ten minutes to put the
above together, after which the script worked just fine. It was
interesting to see how our code had grown to rely on Python 2.3
features without us realising it.
PHP Everywhere: Python vs. PHP?
PHP Everywhere: Python vs. PHP?
03/30/2005 09:12 AMFrom
PHP
Everywhere today:
XML with Xen and with Python
XML with Xen and with Python
12/19/2004 03:53 PMHere is a comment on the paper "Programming with Circles,
Triangles and Rectangles" by Erik Meijer et al. Perhaps interesting
for XML programmers.
Python-SIP 4.0
Python-SIP 4.0
06/23/2004 12:48 PMA tool to generate Python bindings from C++ code.
Python-SIP 4.0.1
Python-SIP 4.0.1
07/06/2004 06:45 AMA tool to generate Python bindings from C++ code.
Another look at PHP and Python
Another look at PHP and Python
02/10/2004 02:46 AMPostscript: Some people have got the impression from this article
that I am moving away from PHP. That is far from the truth. I will
continue to use PHP extensively today, tomorrow and for the forseeable
future.
I find Python harder than PHP.
It could be because we are programming multi-threaded networked
servers in Python, and that
could be inherently harder than coding dynamic web-sites.
Another reason could be lack of familiarity with
Python. For example, I couldn't find the equivalent of htmlspecialchars
and other functions, so i had to roll my own.
Despite all these issues, we are continuing to develop this in
Python because (AFAIK) PHP does not have stable networking frameworks.
So what do I like about Python?
- Neat Syntax
The use of indentation for compound statements discourages deep
nesting, and thus more modular code.
- More Safety Checks
In PHP, when you search using a regular expression, an associative
array is returned.
In Python, a typed object, "match" is returned when a regular
expression search is performed,
and not a generic dictionary. You cannot perform arithmetic on
strings, an explicit cast is required; neither
can you concatenate numbers with strings, explicit typecasts are
needed.
- Supports Multi-Threaded Apps
There exists a global lock in Python that prevents multi-threading
from working effectively on multiple processors - nevertheless Python
has reasonable thread support and allows me to develop reasonably
responsive servers.
- Python's Compiler is Standard
Python has a standard compiler and byte-code format. There is no
such standard in the PHP world, and
most ISP's don't support Zend or Turck MMCache encoded PHP. Better
still, a debugger is included in the package too.
- Python Fully Supports Unicode
Python 2.0 and later has full support for unicode. For example to
convert big5 to unicode is the simple:
unicode_str = unicode(tw_chinese_string, 'big5')
In contrast, see how complicated it is to perform
double-byte to unicode conversions in PHP (see User Notes).
The only issue i had with the unicode support is that it doesn't
come with a complete set of double-byte decoders (eg. big5, gb). After
a 20 minute google search, i found this set of python cjk decoders.
And what I dislike about Python
- Python Is Not Rapid Enough?
I think that PHP is a better tool for rapid application
development, especially for web-sites. Minor type issues are handled
for you transparently in PHP. In Python, once a variable is set,
stricter type-checking is performed on most operations.
So you can argue that Python is safer. But PHP coding is definitely
more rapid.
Another thing i dislike is that Python's import/load facility does
not check .py file modification dates. If i modify a .py file,
Python's run-time environment will not recompile it until i restart
Python, or perform a reload manually from the command-line
interpreter.
- Database Access
Python does not have official database drivers, and you have to
select and download these drivers
yourself. It's easy to get it wrong. For example, only after coding
the adodb_odbc module using PythonWin
odbc extension did i
realize how awful PythonWin odbc was. I then found the mxODBC
extension - unfortunately the mxODBC requires commercial
licensing ($75 per CPU).
- Python is Not That Popular
Popularity is relative. There are lots of Python programmers - but
there are perhaps 3 times more PHP programmers than Python ones. In
Malaysia, the ratio of PHP to Python programmers is probably much
worse (10:1?). And there are many training centers offering PHP
courses. AFAIK, there are no centers in Malaysia offering Python
training.
A quick search in monster.com reveals the following (numbers might
change over time):
PHP: 131 jobs
http://jobsearch.monster.com/jobsearch.asp?q=php&re=0&sort=rv&tm=&fn=6
60&vw=b&cy=US&brd=1%2C1862%2C1863
Python: 41 jobs
http://jobsearch.monster.com/jobsearch.asp?q=python&re=0&sort=rv&t
m=&fn=660&vw=b&cy=US&brd=1%2C1862%2C1863

Python-SIP 4.1.1
Python-SIP 4.1.1
09/24/2004 03:30 PMA tool to generate Python bindings from C++ code.
Python 2.3
Python 2.3
10/28/2003 11:06 PM
Python 2.3 was released
yesterday... and not a moment too soon. I was just swearing under my
breath about this sort of nonsense:
>>> cosmos = technorati.cosmos('http://diveintomark.org/')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "technorati.py", line 214, in cosmos
xmldoc = minidom.parseString(rawdata)
File "/usr/lib/python2.2/site-packages/_xmlplus/dom/minidom.py",
line 1605, in parseString
return expatbuilder.parseString(string)
, in parseString
return builder.parseString(string)
File
"/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py",
line 187, in parseString
parser = self.getParser()
File
"/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py",
line 119, in getParser
self._parser = self.createParser()
File
"/usr/lib/python2.2/site-packages/_xmlplus/dom/expatbuilder.py",
line 734, in createParser
parser.namespace_prefixes = True
AttributeError: namespace_prefixes
OS X users, don't be discouraged by the mention of there being no
MacPython version yet or daunted by the task of compiling it from
source --
MacP
ython 2.3 lives and is just a few glorious GUI installer clicks
away.
Python-SIP 3.9
Python-SIP 3.9
12/08/2003 04:42 PMA tool to generate Python bindings from C++ code.
Python 2.3.3
Python 2.3.3
12/30/2003 05:13 PMA high-level scripting language.
Inline-Python-0.21
Inline-Python-0.21
07/27/2004 05:44 AMPython UnZipped
Python UnZipped
01/05/2004 01:42 PM
Python is a great choice for anyone wanting to play with the
increasingly popular ZIP or GZIP (not covered here) file formats, and
as usual Python makes it surprisingly fun/easy! Don't believe me? In
this article we'll look at creating, extracting, and adding to Zip
archives using Pythons standard zipfile module and defining a set of
functions you can use with your own Zip files; ending with an example
which recursively scans a Zip file and sub-archives.
Javascript from Python
Javascript from Python
12/29/2003 06:51 PMIn a way I'm disappointed to see python-sp
idermonkey released. It's a Python wrapper around the Mozilla
project's SpiderMonkey Javascript
engine which allows Python scripts to execute Javascript code in a
rock-solid, battle-tested embedded interpreter.
Why the disappointment? Because just 5 days ago I decided that a
Python wrapper for SpiderMonkey would be the ideal project for me to
finally attempt to do something productive with C. John J. Lee
evidently beat me to it. I can't complain though, as I was estimating
a good six months to figure out how to get it all working.
Pettiness aside, this looks like a really valuable project. In
addition to being critical for such things as web based unit testing
(John's DOMForm does
exactly that) it may also provide a useful "sandbox" protected
interpreted scripting language for Python projects. Python's own rexec
module is meant to provide a safe sandbox for executing
potentially hostile code but has been disabled due to potential
vulnerabilities. The SeaMonkey Javascript interpreter is tried and
tested in this capacity, at least in its incarnation within the
Mozilla family of web browsers.
Python Revisited
Python Revisited
01/01/2004 02:44 PMHappy New Year! Let's talk shop as usual.
Recently, we've been looking at developing some server software in
Python. This is my first serious look at Python since 1999, and I'm
impressed with the improvements. It's a couple of years older than
PHP, and certainly more mature. Python has a reputation for being
more rationally designed than PHP or Perl, and in general that's true;
but you can still see Python's age in the fact that there are many
APIs that do the same thing (eg. the string functions).
PHP is still a better language for web development because it is a
simpler language, easy to teach to Java or Javascript programmers, has
more flexible string processing, and designed to work well with
templates.
But as a general programming language, Python has its advantages. You
can build sophisticated networking software with Python that supports
threads and asynchronous connections with reasonable efficiency
(though Python doesn't really take advantage of multiple CPU's due to
an internal global lock). The Twisted and Dibbler frameworks are testament to that. Python's
C API is well documented and Python can be easily embedded into 3rd
party apps.
Python is also a good source of design ideas. I have noticed that othe
rs have realized that many good Java ideas do not translate well
to PHP. There is an impedence mismatch; many things that are hard in
Java are easy in PHP. It makes sense to create an elaborate framework
in Java to do something that's hard in Java, but to apply the same to
PHP suggests more energy than sense. In contrast, I suspect that
Python and PHP are more complementary than we all suspect...
PS: We also had a look at developing the same server software using
.NET. However .NET doesn't have builtin support for open protocols
such as POP3 and IMAP. I continue to be amused at the (intentional?)
omissions in the .NET framework.

python-gammu 0.3
python-gammu 0.3
01/05/2004 12:22 PMPython bindings for Gammu.
Python-LDAP 2.0.2
Python-LDAP 2.0.2
07/29/2004 12:57 AMLDAP modules for Python development/deployment.
Dive Into Python
Dive Into Python
09/08/2004 02:50 PMPython SOAP
Python SOAP
12/02/2003 02:41 PMTransition to sourceforge.net
[USN-73-1] Python vulnerability
[USN-73-1] Python vulnerability
02/05/2005 09:38 PMMartin Pitt (Feb 03 2005)
Python SRS Library 0.30.9
Python SRS Library 0.30.9
08/31/2004 02:50 AMA Python Sender Rewriting Scheme library.
"the Python Paradox"
"the Python Paradox"
08/13/2004 03:28 AMPynfo - Python IRC bot
Pynfo - Python IRC bot
08/08/2004 07:05 PMPynfo Unmaintained
Python pie-ing at OSCON
Python pie-ing at OSCON
08/07/2004 05:30 AM
It turns out that the Pythoneers didn't actually
wuss out on pie-ing the Perlies at OSCON -- here's the
photo-evidence.
Lin
k
Python milter 0.7.0
Python milter 0.7.0
08/03/2004 04:22 PMA Python binding for the sendmail milter API with a sample milter.
Python para .NET
Python para .NET
07/30/2004 12:24 PMAh, right--new Python::Bytecode
Ah, right--new Python::Bytecode
07/18/2004 12:04 PMSince I was tired of the fail messages from the CPAN testers, the
generic failures on Win32, and needed some reasonable printing for
debugging and code analysis, I uploaded Python::Bytecode 2.7 to CPAN.
(Or snag it from that link there if you want it)...
Python-Bytecode-2.7
Python-Bytecode-2.7
07/18/2004 05:43 AMpython-gammu 0.4
python-gammu 0.4
01/22/2004 08:38 AMPython bindings for Gammu.
Exim-Python py1
Exim-Python py1
04/26/2004 06:06 AMAn Exim extension for executing Python functions.
X Python Newsreader 0.2.6
X Python Newsreader 0.2.6
04/24/2004 09:03 AMAn online newsreader with Unicode support.
Python in Mathematics
Python in Mathematics
04/21/2004 09:13 PMPython in
the Mathematics Curriculum by Kirby Urner is something of a
sprawling masterpiece. It really comes in four parts: the first is a
history of computer science in education, the second an appraisal of
the impact of open source on education and the world at last, the
third a dive in to the things that make Python so suitable for
enhancing the mathematics curriculum and the fourth a discussion of
how computer science and traditional mathematics are likely to play
off against each other in the field of high school education.
It's a long read, but well worth it. Kirby drops in numerous short
Python code samples, such as this neat little implementation of
Euclid's algorithm for finding the greatest common denominator of two
numbers:
def gcd(a,b):
while b:
a,b = b, a % b
return a
His thoughs on open source and general geek culture are worth
digging out even if the main topic of the paper has no interest for
you. Here's a sample:
Additionally, I think a key cultural phenomenon is the evolving
perception of geek culture as a whole. What many students discover is
a global network of loosely organized, yet talented individuals,
including many free spirits. The network is cosmopolitan and guided by
some newly articulated principles regarding how some forms of
intellectual assets should remain freely accessible and reusable.
While these values might seem another ideological pipe dream, were
they expressed in merely political terms, in this case the lingua
franca of the movement is source code, and licensing agreements
designed to protect it against leaking off into the proprietary
sector. Even though Python may be used in proprietary ways, Python
itself remains free.
Kirby presented the talk at Python DC '04 back in March. I wish I'd
been there, but the conference was too close to SxSW for me to make it
to both.
Python-LDAP 2.0.0
Python-LDAP 2.0.0
05/18/2004 04:41 PMLDAP modules for Python development/deployment.
Python milter 0.6.9
Python milter 0.6.9
04/20/2004 07:39 PMA Python binding for the sendmail milter API with a sample milter.
SAX processing in Python
SAX processing in Python
05/26/2004 04:20 AMAn application developer can choose any one of a number of strategies
to read and use an XML document. In some very simple examples a script
containing a number of regular expressions might do the job, but
normally a more rigorous technique is required. The Simple API for XML
(SAX) is one of the two key techniques for analysing and processing
XML documents (the other is the more complicated Document Object Model
(DOM)).
"my Python code"
"my Python code"
06/08/2004 08:54 AMPython on Panther
Python on Panther
04/09/2004 04:08 PMMac DevCenter has an
interesting article on using Python with Panther (I
wonder who’d win out of those two…), with particular focus
on the CoreGraphics library of image manipulation tools.
This is an interesting alternative to the PHP/
ImageMagick combination which I
currently employ on this site.
X Python Newsreader 0.3.0
X Python Newsreader 0.3.0
06/18/2004 02:27 PMAn online newsreader with Unicode support.
Grok Description matches for MPY (MPi for pYthon)
GrokA matches for MPY (MPi for pYthon)
MPY (MPi for pYthon)