Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52509

Re: Verifying Variable value

From Dave Angel <davea@davea.name>
Subject Re: Verifying Variable value
Date 2013-08-14 12:01 +0000
References <1376475131.60391.YahooMailNeo@web190502.mail.sg3.yahoo.com>
Newsgroups comp.lang.python
Message-ID <mailman.572.1376481740.1251.python-list@python.org> (permalink)

Show all headers | View raw


chandan kumar wrote:

> Hi ,
>

> Is there a way to validate variable values while debugging any python code.Run below example  in debugging mode and i would like to know the value of c (I know print is an option) with any other option other than printing.
> In C# or some other tools we can verify each statement and values. Is there way to check each statement in python code like in c#.
>
> Ex:
> def method()
>   a = 20
>   b =30
>   c =  a + b

I haven't used the language called C# since before it was renamed.  But
if they were at all consistent to its forbears, you must be talking
about assert().

assert() works pretty much the same in Python, though you don't need the
parens.

    assert c==50

will throw an AssertionError if c is unequal to 50


>   <SNIP>
> <html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi ,</div><div><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal;">Is there a way to validate variable values while debugging any python code.Run below example &nbsp;in debugging mode and i would like to know the value of c (I know print is an option) with any other option other than printing.</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: 

Can you please just post via text mail, rather than having superfluous
html which isn't displayable for most users?  Most of the time when
posted code loses indentation, it's the fault of mis-shapen html.

-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Verifying Variable value Dave Angel <davea@davea.name> - 2013-08-14 12:01 +0000

csiph-web