Any other Python flaws?

Mark 'Kamikaze' Hughes kamikaze at kuoi.asui.uidaho.edu
Tue Jun 19 17:55:37 EDT 2001


14 Jun 2001 14:27:59 -0400 in <mailman.992543370.22014.python-list at python.org>,
Andrew Kuchling <akuchlin at mems-exchange.org> spake:
> I was updating my page of possible Python design flaws
> (http://www.amk.ca/python/writing/warts.html) last night to take 2.1
> into account.  2.1's nested scoping fixes one major wart, and the
> other major one, the type/class dichotomy, might get fixed in 2.2 if
> the descr-branch in CVS turns out well.  (It's neat that the two
> largest ones may both get fixed before 2001 is out.)
> 
> That leaves the remaining warts as minor wibbling about 'do'
> statements, print >>, and the like.  Are there any other flaws that
> should be added?

  You missed one of the main warts of raw strings: You can't have a
single \ at the end of a raw string:
>>> r'foo\'
  File "<stdin>", line 1
    r'foo\'
          ^
SyntaxError: invalid token
>>> r'foo\\'
'foo\\\\'

  Supporting a 'super' keyword that just referred to the first
superclass would solve the base class problem most of the time, unless
other people are making really heavy use of multiple inheritance and
haven't mentioned it to me.  Having to do it "by hand" on what I presume
are only a few cases is preferable to having to do it by hand every time
as we currently do.

  Integer division is fine and wonderful as-is, and any change to the /
operator would break an amazing amount of code.  Adding a new 'div'
operator that does fp division if necessary would be okay, though.  I
dunno what that gains you over doing 7.0 / 2 or 7 / 2.0 or a/float(b),
though.  Yes, it's a programmer-ism.  But you know, mostly programmers
use Python.

  The lack of do...while or repeat...until is of little interest to me,
but named blocks or some way of doing a break/continue from multiple
nested loops would be really nice.  This is mainly an issue for me
because I have to do a fair amount of:
    for y in xrange(size):
        for x in xrange(size):
            ...stuff...
            if condition:
                breakflag=1
                break
        if breakflag: break

  But I mostly wrap these loops inside methods and just return from the
inner loop, so it just forces me to write smaller methods, which is good
style anyway.

-- 
 <a href="http://kuoi.asui.uidaho.edu/~kamikaze/"> Mark Hughes </a>
"I will tell you things that will make you laugh and uncomfortable and really
fucking angry and that no one else is telling you.  What I won't do is bullshit
you.  I'm here for the same thing you are.  The Truth." -Transmetropolitan #39



More information about the Python-list mailing list