python development practices?

Skip Montanaro skip at pobox.com
Thu Nov 1 16:09:37 EST 2001


    Cliff> As an aside, it wouldn't surprise me to find that many people who
    Cliff> "can't upgrade from 1.5.2" because some application they've
    Cliff> written breaks under 2.x are the victims of name collisions
    Cliff> introduced in newer versions of the standard libraries that they
    Cliff> are deriving from.  The results of such collisions would be
    Cliff> highly unpredictable and difficult to track down.

Hmmm...  I wonder if pychecker can be taught to check for this:

    class A:
        def __init__(self):
            self.x = 1
            self.y = 1

    class B(A):
        def __init__(self):
            self.x = 10
            A.__init__(self)
            self.y = 10

Ideally, it would warn about the assignment to self.x in B.__init__, but
possibly not the assignment to self.y.

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list