Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

  (email not shown publicly)
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Tuesday March 28, 2006
10:34 PM

python programmers unbellyfeel oldcode

[ #29141 ]

I just love this blog entry from Guido. It's just about a year old now -- it was resent verbatim (replacing Python with Scheme) to some Scheme lists as an April Fool's joke. Guido is talking about how he'd like to drop filter, reduce, and map. He says:

I think having the two choices side-by-side just requires programmers to think about making a choice that's irrelevant for their program; not having the choice streamlines the thought process.

He's talking about how nested functions can substitute for lambdas. In other words, he wants to make it even less possible to have something like anonymous code blocks in Python. See, removing those function applicators will help make that decision seem reasonable:

Also, once map(), filter() and reduce() are gone, there aren't a whole lot of places where you really need to write very short local functions; Tkinter callbacks come to mind, but I find that more often than not the callbacks should be methods of some state-carrying object anyway (the exception being toy programs).

Right. If you ever want a closure, you probably want an object. Right?

Anyway, it makes the language clearer. He writes:

filter(P, S) is almost always written clearer as [x for x in S if P(x)]

I just don't understand the audience.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Well, OTOH, Python does have this thing where you can “call” an object as if it were a function, which will invoke the __call__ method on the object. So a function and an object-that-provides-__call__ are interchangeable in Python, which makes the latter a sort of closure.

    Except it doesn’t have any of the syntactical sugar of a closure.

    Then again, you wouldn’t know, since scopes are weird in Python anyway.

    I, uhm… guess it’s an odd language.