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

namekuseijin namekuseijin at gmail.com
Mon May 11 09:56:12 CEST 2009


On May 10, 7:18 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> On May 10, 12:40 pm, namekuseijin <namekuseijin.nos... at gmail.com>
> wrote:
> theoretical argument like, "everything reduces to a function so it
> doesn't matter what syntax you use," yet people in the real world are
> out there trying to find alternatives because functional languages'
> syntax sucks so bad in general.

It's not that it sucks.  More that it's pretty much non-existent.
Yes, many people are very sensitive to such issue -- that is, that
they feel lost without common constructs permeating the code rather
than the fluid and recursive nature of functional programming and its
never-ending flow of userland function calls.

OTOH, I can't help but think part of it has to do with plain text in
your face rather than lots of colorful keywords in your fav editor.

> The reason the OP was asking about separating pure code from impure
> was to see if some subset of Python could be used as a pure functional
> language, that way they could employ Python and its already-much-
> better-than-Haskell's syntax as a pedagogical replacement for Haskell.

ah, probably.  Python has replaced Scheme in certain pedagogical
circles too.  Scheme was considered a great tool for teaching basic
compsci concepts *precisely* for it's lack of syntax so that students
could concentrate on the concepts and problems at hand rather than
fight against the compiler or have to learn a huge tome of libs and
frameworks before even outputting a single "hello world".

But Java was all the rage in the past few years at introductory
compsci and at least no doubt Python is a blessing compared to that.
Though it too is not without a lot of quirks itself...

> I am sure there are many people who think that even "f a b" is cryptic
> compared to "f(a,b)", but if that's the only issue it wouldn't be that
> big of a deal.  It's not the only issue.  When a language requires you
> to read and write stuff like "map :: (x -> y) -> f x -> f y"

This is a type annotation and there's nothing similar in Python given
it's typeless nature.  Should I call Python's non-existent type
annotations horrible too?

>"f s@ (x:xs) = x:s" then it's going to turn a lot of people off.

what about

@foobize
def dingle( n, *boz ): return boz[n:-2]

?  Sounds perfectly cryptic for the non-initiated too.



More information about the Python-list mailing list