I'm intrigued that Python has some functional constructions in the language.

Carl Banks pavlovevidence at gmail.com
Fri May 8 16:34:03 EDT 2009


On May 8, 12:04 pm, Casey Hawthorne <caseyhHAMMER_T... at istar.ca>
wrote:
> I'm intrigued that Python has some functional constructions in the
> language.
>
> Would it be possible to more clearly separate the pure code (without
> side effects) from the impure code (that deals with state changes,
> I/O, etc.), so that the pure code could be compiled and have
> aggressive functional transformations applied to it for efficiency.

No not really, at least not in any way that it maintains compatibility
with Python.

Python does either expose or mimic the parsing process to the user, so
you could maybe exploit it to get parse trees of functions (checking
that there is nothing that has side-effects) to feed to a specialized
optimizer, but if you do that it might as well be a new langauge.


> That way, the syntax would be a lot easier to understand, than most
> functional languages, like Haskell.
>
> I gave a presentation at the beginning of last year on Haskell and at
> the end, someone's comment was, "I can see the benefits of functional
> programming but why does it have to be so cryptic."

A couple thoughts:

1. It's just one person's opinion.
2. However, functional programming is cryptic at some level no matter
how nice you make the syntax.


Carl Banks



More information about the Python-list mailing list