Two different values for same variable “args”

后端 未结 1 593
余生分开走
余生分开走 2021-01-14 02:40

I am invoking a method from python script which has one of the variable as args. Once I step into the method, when I am trying to see the value of the the variable args, \"

相关标签:
1条回答
  • 2021-01-14 03:04

    args is a PDB debugger command. Use !args to show the actual variable.

    See the Debugger Commands section:

    a(rgs)
    Print the argument list of the current function.

    and

    [!]statement
    Execute the (one-line) statement in the context of the current stack frame. The exclamation point can be omitted unless the first word of the statement resembles a debugger command.

    (Emphasis mine).

    In your args output you can see the args argument value on the first line.

    Personally, I find the (a)rgs command a little pointless; it prints all values using str() instead of repr(); this makes the difference between objects with similar __str__ output values invisible (such as str vs. unicode, or a BeautifulSoup Element vs. a string with HTML, etc.).

    0 讨论(0)
提交回复
热议问题