Python Scalability

David Cuthbert dacut at kanga.org
Sun May 23 15:32:22 EDT 1999


Greetings, Pythoners...

I've been using Python for about five months, both at work and at home, and
have found it to be a pleasure.  However (and you probably guessed this was
coming... isn't everyone a critic? :-), I was wondering if there were any
planned revisions to the type system for the next release.  I've noticed a
few problems when scaling to medium-sized (~10-30 kloc) projects; these are
probably specific to my style of coding, but I suspect that this may be
happening to others, as well.

My biggest nit: those annoying AttributeError exceptions!  They usually crop
up when I'm changing things (adding a method a set of classes) and don't do
a thorough job (a rarely used class doesn't get the method added).  Then I
call a function which uses the method, and -- oops! I passed in an object
whose class didn't get modified.  Down comes the AttributeError...

Types are probably not the best thing to restrict in Python -- in
particular, it would break objects that act like file objects (and since
there is no common base such as C++'s istream or ostream to inherit from,
this wouldn't work).  What I'm really interested in is whether a given
function or object supports a specified interface:  e.g., I can safely call
obj.m(1, 2) and get a list object back (or an exception).

At run time, trying to use an object which didn't meet the interface would
generate an exception (not unlike the AttributeError exceptions I currently
run into).  Static analysis, however, could be used at or before compile
time to make sure that these types of errors do not happen.

The big advantage is that it would point out dumb errors that might be
difficult to test.  Well, ok... the REAL big advantage would be that it is
yet another way of making sure the customer doesn't call me and ask why my
tool crashed and printed out a stack trace with an "AttributeError"
exception. :-)

Aside from that, Python is a nice language to use.  Oh, sure, there's the
strange "for" syntax, the "while 1" construct, and the whitespace-eating
nanorobots I run into from time to time... :-)
---
Dave Cuthbert
dacut at kanga.org
dacut at neolinear.com (but not speaking for my employer)







More information about the Python-list mailing list