I'm intrigued that Python has some functional constructions in the language.
Lie Ryan
lie.1296 at gmail.com
Fri May 8 23:58:46 EDT 2009
Casey Hawthorne 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.
Choosing a better algorithm usually have much more impact on efficiency
than programming to the language's optimization scheme. A slow algorithm
will always be slow no matter how much (functional or regular)
optimization in it[1]. If you bother efficiency that much, maybe python
is not the best suited language for you.
> That way, the syntax would be a lot easier to understand, than most
> functional languages, like Haskell.
Python's syntax is already easier to understand than most functional
language, and it also support functional-style programming. However,
python is still an imperative language, no matter how much functional
functionalities (pun not intended) is in it.
[1] of course there are certain types of optimizations -- that actually
changes the algorithm -- that may have a significant impact, such as
memoization. However if you know memoization well enough, you wouldn't
want to activate it on all pure functions...
More information about the Python-list
mailing list