Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52509 > unrolled thread
| Started by | Dave Angel <davea@davea.name> |
|---|---|
| First post | 2013-08-14 12:01 +0000 |
| Last post | 2013-08-14 12:01 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Verifying Variable value Dave Angel <davea@davea.name> - 2013-08-14 12:01 +0000
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2013-08-14 12:01 +0000 |
| Subject | Re: Verifying Variable value |
| Message-ID | <mailman.572.1376481740.1251.python-list@python.org> |
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 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 top | Article view | comp.lang.python
csiph-web