[Tutor] printing variable name and value?

Remco Gerlich scarblac@pino.selwerd.nl
Wed, 31 May 2000 22:20:04 +0200


On Wed, May 31, 2000 at 09:48:21PM +0200, Borgulya Gabor wrote:
> I have found a working, but unstable solution for my own question:
> 
> import traceback
> def prvar(__x):
>     print traceback.extract_stack(limit=2)[0][3][6:][:-1],"=",__x

How horrific. I can't really think of another way either. I like it.

Are you sure you don't just want to do "prvar('x',x)"? :)

-- 
Remco Gerlich,  scarblac@pino.selwerd.nl