merits of Lisp vs Python
Paul Rubin
http
Fri Dec 15 18:35:02 EST 2006
André Thieme <address.good.until.2006.dec.22 at justmail.de> writes:
> And I didn't count the indentation level and \n in Python code.
> Why should I? They are editor commands.
No they're part of Python syntax. A change in indent level is
recognized by Python's lexical scanner as a token and you should count
it. You wouldn't count the indent and \n separately though.
> > Anyway, token count doesn't mean much, you have to instead go by the
> > user's cognitive effort in dealing with the prefix notation etc.,
>
> How complicated ss it to say "cmp(a, b)" compared to "a cmp b"?
It gets worse when the expressions are nested.
> Imagine Python would have an "anaphoric if", "aif". Then:
>
> aif timeConsumingCalculation():
> use(it)
Well, it's not really in the Pythonic style to add obscurity like
that, but you could certainly write something like:
def aif(func):
it = func()
if it: use(it)
aif(timeConsumingCalculation)
> So in some languages that support functional programming one needs
> to do extra work to get lazyness, while in Haskell one gets extra
> work if one doesn't want it. But maybe someone can correct me here...
> In Lisp one could build some features to get lazyness as well.
I think that is essentially correct. But it's not so easy to do extra
work to get Haskell-like laziness in languages that don't have it, not
because laziness itself is difficult, but non-lazy languages usually
end up giving up referential transparency.
http://lambda-the-ultimate.org/classic/message5750.html
More information about the Python-list
mailing list