print is not a function

Karl Scalet news at yebu.de
Thu Oct 9 03:37:12 EDT 2003


Gerrit Holl wrote:

> Karl Scalet wrote:
> 
...
> 
> How about:
> 
> import qt
> pprint.pprint(qt)
> 
> ?

returns:
<module 'qt' from ....>

That's not the info i was for.
normal practice in qt-programming is
 > from qt import *
now you can
 >>> pprint(locals())
as most of what's in this namespace now is
qt-related anyhow. But when it comes to
narrow down this list, as there are so
many items in it, I thougt using a list
comprehension with a condition would be
nice, even if I'm not longer sure after
all the responses :-).

For interactively inspecting things, I think
having it in one line is nice, as it's
easiest to recall from commandline history.

Which way?:
 >>> [ pprint(x) for x in locals() if x[:3]=='QAc' ]
or
 >>> for x in locals():
 >>>     if x[:3] == 'QAc':
 >>>         print x

I cannot put this second one in a single line, so I
will stay with my list-comprehension-solution unless
I'm getting a better idea.

Karl





More information about the Python-list mailing list