jonathanslenders / ptpdb

prompt_toolkit/ptpython pdb frontend
181 stars 20 forks source link

Unable to reassign variables inside a class #16

Open lmwang9527 opened 8 years ago

lmwang9527 commented 8 years ago

I have this simple code defining a class:

class test:
    def __init__(self):
        x = [0, 0]
        y = 0
        #import pdb; pdb.set_trace()
        import ptpdb; ptpdb.set_trace()

test()

When I use ptpdb to inspect the variables inside the class, I cannot reassign their value:

--Return--
-> ptpdb_test.py(6)__init__()->None
     import ptpdb; ptpdb.set_trace()

  >>> x
[0, 0]

  >>> x = [1, 1]

  >>> x
[0, 0]

  >>> y
0

  >>> y = 1

  >>> y
0

which is a different behavior than pdb:

--Return--
> /tmp/ptpdb_test.py(5)__init__()->None
-> import pdb; pdb.set_trace()
(Pdb) x
[0, 0]
(Pdb) x = [1, 1]
(Pdb) x
[1, 1]
(Pdb) y
0
(Pdb) y = 1
(Pdb) y
1

Using ptpdb version 0.15 on python 2.7.11