Python complaints

Gareth McCaughan Gareth.McCaughan at pobox.com
Wed Nov 24 05:38:27 EST 1999


Mark Carroll wrote:

> Basically, I'd be really interested to learn: what _don't_ people like
> about Python?

  - if/then/else works on *statements* (strictly, suites of
    statements) rather than on *expressions*, so I can't
    say
      print "You scored %s point%s" % (score, if score==1 then "" else "s")
    or anything like that. (Or, as some people prefer to put it,
    Python has no ? : operator.)

    In fact, the distinction between statements and expressions
    is in my view a wart. (Lots of people would, of course,
    disagree.)

  - Memory management is by refcounting instead of GC. This
    has its good points (it means that one can define more
    precisely when e.g. finalisation happens), but it does
    mean that if you build structures with cycles in the
    reference graph then they won't get GCed when you want
    them to. This is a real nuisance, for instance, when
    you're exploring ideas or debugging: suppose you have
    a piece of code that builds a big data structure out of
    class instances; then every time you make a small change
    and run it again (you have to run it again, because
    existing instances belong to the old versions of the
    classes) you can be leaking a lot of memory.

  - Method definitions have to be lexically contained in
    class definitions. So suppose you write something that
    parses a language and then does various things with
    the parse tree; if you adopt an OO approach to the
    parse tree (with things like "class IfStatement(ParseNode):")
    then you can't separate out very different operations like
    foo.print(), foo.compile() and foo.evaluate(). (That is,
    you can't group all the print methods together, and group
    all the compile methods together somewhere else, etc.)
    You can, of course, split your code up by having the WhileLoop
    and UntilLoop classes in different files, but this seems
    less sensible to me. :-) (This particular gripe applies to
    most OO languages.)

  - The Python interpreter is rather slow. (I'm talking about
    CPython here. I believe JPython is usually somewhat slower.)

  - Some more iteration constructs would be nice.

      - do ... while
      - parallel iteration across more than one list
      - a less yucky way of saying "for i in range(1,20,3)"

-- 
Gareth McCaughan  Gareth.McCaughan at pobox.com
sig under construction




More information about the Python-list mailing list