-
Notifications
You must be signed in to change notification settings - Fork 951
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
show object attributes, not just local variables #7
Comments
That's what the `variables` argument is for.
Also, if the classes' `repr` uses these attributes, they'll show up even if
they aren't included in `variables` .
…On Mon, Apr 22, 2019, 16:23 Tony Rice ***@***.***> wrote:
Consider this code:
class Foo():
def __init__(self):
self.a = 1
self.b = 2
self.c = None
@pysnooper.snoop()
def myfunc(self):
localvar = 5
localvar += 1
self.c = self.b + self.a
pysnooper's output when calling myfunc:
Starting var:.. self = <snooptest.Foo instance at 0x1052c5b90>
08:50:38.552499 call 16 @pysnooper.snoop()
08:50:38.553309 line 18 localvar = 5
New var:....... localvar = 5
08:50:38.553382 line 19 localvar += 1
Modified var:.. localvar = 6
08:50:38.553457 line 20 self.c = self.b + self.a
08:50:38.553560 return 20 self.c = self.b + self.a
The values of self.a, self.b, and self.c are not shown by pysnooper but
are the primary purpose of this method.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#7>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAN3SRLATTZU5LTBC6HLIDPRW343ANCNFSM4HHPVXXQ>
.
|
But doesn't that defeat the purpose of this easy to use debugging decorator? Having to specify which variables you want to be instrumented? |
It's true that specifying variables is annoying. However, if we tried to
guess all the attributes that might interest the user, we might have guess
too much, overcrowd the output, lose performance and cause exceptions.
…On Mon, Apr 22, 2019, 16:27 Tony Rice ***@***.***> wrote:
That's what the variables argument is for. Also, if the classes' repr
uses these attributes, they'll show up even if they aren't included in
variables .
… <#m_7236350608064829912_>
On Mon, Apr 22, 2019, 16:23 Tony Rice *@*.***> wrote: Consider this code:
class Foo(): def *init*(self): self.a = 1 self.b = 2 self.c = None
@pysnooper.snoop() def myfunc(self): localvar = 5 localvar += 1 self.c =
self.b + self.a pysnooper's output when calling myfunc: Starting var:..
self = <snooptest.Foo instance at 0x1052c5b90> 08:50:38.552499 call 16
@pysnooper.snoop() 08:50:38.553309 line 18 localvar = 5 New var:.......
localvar = 5 08:50:38.553382 line 19 localvar += 1 Modified var:.. localvar
= 6 08:50:38.553457 line 20 self.c = self.b + self.a 08:50:38.553560 return
20 self.c = self.b + self.a The values of self.a, self.b, and self.c are
not shown by pysnooper but are the primary purpose of this method. — You
are receiving this because you are subscribed to this thread. Reply to this
email directly, view it on GitHub <#7
<#7>>, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAN3SRLATTZU5LTBC6HLIDPRW343ANCNFSM4HHPVXXQ
.
But doesn't that defeat the purpose of this easy to use debugging
decorator? Having to specify which variables you want to be instrumented?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAN3SSRZBMPUOJGDRF4FE3PRW4MJANCNFSM4HHPVXXQ>
.
|
Consider this code:
pysnooper's output when calling myfunc:
The values of self.a, self.b, and self.c are not shown by pysnooper but are the primary purpose of this method. parameters on self should also be shown as starting values in methods decorated by pysnooper
The text was updated successfully, but these errors were encountered: