Joop,

I haven't been able to recreate your error.

Please specify your version of Python and OS, and explain the steps required
to recreate this error.

- Tal


On 28/11/06, *Joop Kaldeway* <[EMAIL PROTECTED]> wrote:


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:

3
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'
[DEBUG ON]
>>>

Is it a bug in IDLE?

Joop Kaldeway



_______________________________________________
IDLE-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/idle-dev

_______________________________________________
IDLE-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/idle-dev

Reply via email to