[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zen of Python



On Mon, 27 May 2002, Paul Prescod wrote:

> The problem with your examples is that it is Perl/Ruby that is regular,
> not Smalltalk. Perl/Ruby combined their normal rules for operator
> combination. Smalltalk made a special-case method to handle that
> particular problem. The Smalltalk way will increase the regularity of
> code by encouraging a single idiom, but it will did not increase the
> regularity of the language.

Ah, it depends on your definition of regularity.  The whole notion of
operator combination, or, indeed, operator, isn't needed in Smalltalk.
I'm much more concerned about special-case syntax than I am about
special-case methods (what's a special case method?  Isn't every method
special-case?)

> > Lisp has a very similar combination of regularity and power.  I don't know
> > what the equivalent Lisp idiom would be, if there is one, but you
> > certainly could write a function that allowed something like
> > (hash-ref dict 'foo' :if-absent-put (lambda () 42)).
>
> In what language could you NOT write such a function?

In a language without closures and keyword args.  Python qualifies,
but many don't.