print is not a function

Karl Scalet news at yebu.de
Thu Oct 9 04:31:21 EDT 2003


Wolfram Kraus wrote:

> Heyho!
> 
> Karl Scalet wrote:
> [...]
> 
>> 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
>>
> 
> Why don't you wrap it in a function and put it in your 
> $PYTHONSTARTUP-file? That way you can call it very fast and don't need 
> to remember a one-liner.
> 
> Wolfram
> 

Hello Wolfram,

you're right, that would be best. I myself however always end up
not having all the helper functions available after a while, working
in different environments. But that's more an organizational problem:-)

Thanks anyhow,
Karl





More information about the Python-list mailing list