Python from Wise Guy's Viewpoint

Lulu of the Lotus-Eaters mertz at gnosis.cx
Sun Oct 19 16:21:01 EDT 2003


|1. f(x,y,z) sucks. f x y z  would be much easier to type (see Haskell)
|   90% of the code is function applictions. Why not make it convenient?

Haskell is cool.  But to do what you want, you need uniform currying of
all function calls (i.e. every call is a call with *exactly one*
argument, often returning a new function).  That's not a reasonable
model for Python, for lots of reasons (but you are welcome to use
Haskell, I understand you can download versions of it for free).

|2. Statements vs Expressions business is very dumb. Try writing
|   a = if x :
|           y
|       else: z

Try writing ANYTHING that isn't Python... wow, it doesn't run in the
Python interpreter.

|3. no multimethods (why? Guido did not know Lisp, so he did not know
|   about them)

Been there, done that... we got them:

    http://gnosis.cx/download/gnosis/magic/multimethods.py

|4. splintering of the language: you have the inefficient main language,
|   and you have a different dialect being developed that needs type

I think this might be a reference to Pyrex.  It's cool, but it's not a
fork of Python.

|5. Why do you need "def" ? In Haskell, you'd write
|   square x = x * x

Again, you are welcome to use Haskell.  If you'd like, you can also
write the following in Python:

    square = lambda x: x*x

|6. Requiring "return" is also dumb (see #5)

'return' is NOT required in a function.  Functions will happily return
None if you don't specify some other value you want returned.

|7. Syntax and semantics of "lambda" should be identical to
|   function definitions (for simplicity and uniformity)

Obviously, they can't be *identical* in syntax... the word 'lambda' is
SPELLED differently than the word 'def'.  The argument has been made for
code blocks in Python at times, but never (yet) convincingly enough to
persuade the BDFL.

|8. Can you undefine a function, value, class or unimport a module?

Yes.

|9. Syntax for arrays is also bad [a (b c d) e f] would be better
|   than [a, b(c,d), e, f]

Hmmm... was the OP attacked by a pride of commas as a child?

It's true that the space bar is bigger on my keyboard than is the comma
key... but I don't find it all THAT hard to press ','.

Actually, the OP's example would require some new syntax for tuples as
well, since there's no way of knowing whether '(b c d)' would be a
function invocation or a tuple.  Of course other syntaxes are
*possible*.  In fact, here's a quick solution to everything s/he wants:

    % cp hugs python

Yours, Lulu...

--
mertz@  | The specter of free information is haunting the `Net!  All the
gnosis  | powers of IP- and crypto-tyranny have entered into an unholy
.cx     | alliance...ideas have nothing to lose but their chains.  Unite
        | against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------






More information about the Python-list mailing list