469,289 Members | 2,063 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,289 developers. It's quick & easy.

Issue with inspect module

Hi,
I have this trivial program:

import inspect
class A:
def __init__(self, a):
self.a = a
def __str__(self):
return 'A(%s)' % self.a
a = A(8)
print a

the output is:
A(8)
A(8)

Why does the inspect module cause the output
to be printed twice?

Thanks
Jun 27 '08 #1
3 741
2008/4/19, il*********@gmail.com <il*********@gmail.com>:
Hi,
Hello,
I have this trivial program:

import inspect
class A:
def __init__(self, a):
self.a = a
def __str__(self):
return 'A(%s)' % self.a
a = A(8)
print a

the output is:
A(8)
A(8)

Why does the inspect module cause the output
to be printed twice?
I have just run it on the CPython interpreter and it works well. Have
you tried it without the 'import inspect' line and checked there is no
problem?

Or maybe are you using another interpreter?
Jun 27 '08 #2
Why does the inspect module cause the output
to be printed twice?
I also tested it, no problem here either.
Jun 27 '08 #3
On Apr 19, 1:41 pm, Karl-Heinz Ruskowski <kay...@googlemail.com>
wrote:
Why does the inspect module cause the output
to be printed twice?

I also tested it, no problem here either.
I realized what the problem was.
I called the file inspect.py, stupid me.

Thanks
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Fernando Perez | last post: by
11 posts views Thread by It's me | last post: by
1 post views Thread by Darran Edmundson | last post: by
4 posts views Thread by Benjamin Rutt | last post: by
reply views Thread by Ron Adam | last post: by
3 posts views Thread by Tool69 | last post: by
4 posts views Thread by Chris Pax | last post: by
reply views Thread by Stef Mientki | last post: by
8 posts views Thread by Aaron \Castironpi\ Brady | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.