What does Python fix?

Jason Orendorff jason at jorendorff.com
Thu Jan 24 21:15:05 EST 2002


Time Peters wrote:
> [James Althoff]
> > But we all know that's *only* because y'all haven't given us syntax for
> > nameless code blocks -- yet. <wink>
> 
> But we have!  Take your <nameless code block> and write it like so:
> 
> def <aname>():
>     <nameless code block>
> 
> This is what Smalltalk was striving for, but it failed to achieve a key
> insight:  nameless code blocks are easier to reuse if they're 
> named <wink>.

Look, obviously what's needed is some simple notation
like >> for indent and << for dedent, thus:

  mylist.sort(lambda a, b: >> g = cmp(a.name, b.name);
               if g: >> return g; <<
               return cmp(a.id, b.id); << <<)

Now, I ask you, is that so bad?
I mean, you don't have to get all tongue-in-cheek about it.  ;-)

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list