How to validate the __init__ parameters

Albert van der Horst albert at spenarnc.xs4all.nl
Mon Jan 4 17:00:22 EST 2010


In article <mailman.423.1262627230.28905.python-list at python.org>,
Chris Rebert  <clp2 at rebertia.com> wrote:
>On Mon, Jan 4, 2010 at 10:17 AM, Albert van der Horst
><albert at spenarnc.xs4all.nl> wrote:
><snip>
>> This triggers a question: I can see the traceback, but it
>> would be much more valuable, if I could see the arguments
>> passed to the functions. Is there a tool?
>
>print(locals()) #this actually gives the bindings for the entire local namespace
>#but is less work than writing something more precise by hand.
>
>It is amazing how handy the humble print() function/statement is
>when debugging.

It is also amazing how much output is generated in this way in a
typical Euler program (that require seconds, if not minutes solid
computer time on Giga Hz machines). I have to routinely clean out
my 30 Gbyte home directory. Not so long ago generating so much debug
output wasn't an option!

What I hoped for is something along the line of what you can do
with a coredump in a classical debugger. Especially if recursion
runs dozens of levels deep, it is difficult to keep track.

But locals() is nice function, thanks.

>
>Cheers,
>Chris

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst




More information about the Python-list mailing list