Thoughts on Perl and Emacs, technology and writing

Python “Unique” Features

I finally got around to watching the Python keynote recommended by Steve. Two thirds of the “things we have that other people don’t have” is Python finally catching up with Perl features from 1995 and they were in other languages more than 10 years before that (is that ignorance or the Blub effect?). And we already have the rest in various libraries.

Oh well…

Advertisements

Share this:

Like this:

Related

8 Responses

Just watched the video. It would be interesting to present the perl solutions to the snippets presented in the video. IMHO there are some nicenesses in there. And most of them don’t need the installation of any add on package. “Batteries included” is a big plus, because you don’t need to think about configuration management as long as you can stick to the standard libraries.

>Christian points out that decorators are simply method modifiers and due to limitations in Python itself, can’t be implemented directly in the language.

Can you explain this point to the non-Perlistas? Decorators can modify functions or classes or methods and they are “implemented directly in the language” if by that you mean I write decorators in Python…

As you can see, Python is perfectly able to modify a function with another function. Decorators buy two things: 1) you don’t have to say “def foo” followed by “foo =”, and 2) you don’t have to pass both the function to modify AND any arguments to the modifier when you modify the function.

Otherwise, it’s all the same thing. This is why Mr. Hettinger, in the video we’ve all apparently say through now, says that his original objection to decorators was that they were purely sugar. They do nothing but improve the notation–no added functionality at all.

The thing Perl programmers seem to overlook about Python is that, while it doesn’t permit multi-line anonymous subs, and it doesn’t have block scope, it DOES allow nested, lexically scoped functions, and it lets you pass them around easily and call them with one simple, consistent syntax (i.e. put parens after it). This buys you back a lot. (Just to be clear, f, the nested function above, is not directly callable outside of decorate()–it’s out of scope.)

(I sure hope this formats nicely and that it makes sense to somebody.)

Actually steve – I’d argue that what you explained is a decorator. The @decorate syntax is just syntactic sugar. And I went off and read about nested functions (or the lack thereof) in Perl and understand why limited lambda seems like a crippling blow to Perlistas.

All that to say that (if I them understand correctly) Christian’s assertions about decorators and Python are incorrect.