Call Perl from Python This is an oldie but a goodie, but a lot of bad programmers don't realize they can make their Python code even worse, if they embed a bunch of untested, legacy, Perl code in it. There is a Perl/Python module that makes this a snap. Yes, throw in a Perl slight for good measure. A surer way of endearing yourself to your fellow Pythonistas , I know of not. This is not unlike what happens on reddit.…
Perl, that miserable little unwanted orphan of a language, has real anonymous, first-class functions complete with closures. Python, sadly, does not Which Python are you talking about? The language I use has had closures and first-class functions for years.
>>> def foo():
... blah = 42
... def wibble():
... print "blah is " + blah
... wibble()
...
>>> foo()
blah is 42
Great! Looks like we have real closures! >>> def foo():
... blah = 42
... def wibble():
... blah += 1
... wibble()
... print "blah is " + blah
...
>>> foo()
Traceback (most recent call last):
File "", line 1, in
File "", line 5, in foo
File "", line 4, in wibble
UnboundLocalError: local variable 'blah' referenced before assignment
Oh. Maybe not.