[Idle-dev] a debug problem

Joop Kaldeway joop.kaldeway at planet.nl
Tue Nov 28 16:11:51 CET 2006

Dear idle-developers,.

I have the following problem:

I use the very simple program:

class NewClass(object):

    def __init__(self,element):
        self.element = element
    def __repr__(self):
        return str(self.element)

if __name__ == '__main__':

    b = NewClass(3)
    print b

    raw_input("Press Enter to finish")

It runs with output:

Press Enter to finish

But when I use te debugger and walk through the code step by step  I get 
an error:

  File "E:\Python25\lib\repr.py", line 34, in repr1
    s = __builtin__.repr(x)
  File "F:\demo\NewClassDemo.py", line 24, in __repr__
    return str(self.element)
AttributeError: 'NewClass' object has no attribute 'element'

Is it a bug in IDLE?

Joop Kaldeway

More information about the IDLE-dev mailing list