Why is Python popular, while Lisp and Scheme aren't?
Greg Ewing
see_reply_address at something.invalid
Tue Nov 12 00:29:07 EST 2002
Pascal Costanza wrote:
> Greg Ewing wrote:
>> Python still goes one better, because (for user-defined
>> methods at least) you can supply arguments by keyword even
>> if they *haven't* been declared that way!
>
> No problem.
>
> (defun paint (&key on at &allow-other-keys)
> ...)
No, I was talking about the way you can do
def f(x, y):
...
and call it as
f(y = 42, x = 17)
In other words, you don't have to know when you write
the function that you're going to want to call it with
keywords later -- you just do it.
I use this a lot when a function has one or more arguments
that are booleans. I find it a lot more readable to
always pass them using keywords.
--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
More information about the Python-list
mailing list