What can you do in LISP that you can't do in Python
dnew at san.rr.com
Wed May 23 15:44:49 EDT 2001
Alex Martelli wrote:
> I often react hotly to wild, unsupportable and extraordinary
> claims, if that is what you mean. If those claims come in
> part from somebody deciding to criticize a language on the
> basis of a flawed/incomplete knowledge of that language, I
> hardly think this is MY responsibility...:-).
The reason I didn't think it thru complete w.r.t. Python was that I
wasn't criticising the language. I was merely stating that giving the
function a name isn't the only restriction. It also has to appear in a
different place. I wasn't attacking Python, but merely mentioning an
additional difference you may not have thought of.
I.e., if I have a function that tells me how many times its argument can
be called before it returns true, I can't call it in one line in Python
(assuming a lambda won't do). I have to do something like
def test(): yadda yadda
x = count_true(test)
In Smalltalk, this is
x = count_true( [yadda yadda] )
with apologies for the mixed up smalltalk+python syntax.
Even if I had to give the function a name, the first block of code would
be less clear to me than
x = count_true( def test(): yadda yadda )
because in the latter, I can tell there's only one place that function
gets used, and in the former I can't. There's an extra level of
formalism I have to follow, to find the definition of test based on its
name later, that logically doesn't need to be there because there's only
one place its defined and one place its used.
I would find it equally unclear to have a language where (for example)
all declarations have to come at the start of the block or all literals
had to be given names, exactly for the same reason.
Darren New / Senior MTS & Free Radical / Invisible Worlds Inc.
San Diego, CA, USA (PST). Cryptokeys on demand.
This is top-quality raw fish, the Rolls-Rice of Sushi!
More information about the Python-list