0

Following the canonical advice of this post, I am trying to cast my dict_keys object to a list. It works in the python 3.6.5 interpreter just fine. However, when I do it in pdb, it does not work. E.g.

>>> import pdb; pdb.set_trace()
--Return--
<function save_history at 0x100369e18>
> <stdin>(1)<module>()->None
(Pdb) newdict = dict()
(Pdb) newdict["pig"] = "pink"
(Pdb) newdict["finch"] = "yellow"
(Pdb) newdict.keys()
dict_keys(['pig', 'finch'])
(Pdb) list(newdict.keys())
*** Error in argument: '(newdict.keys())'

How do I get this to work in pdb?

irritable_phd_syndrome
  • 4,631
  • 3
  • 32
  • 60

1 Answers1

4

list is a pdb command to list source code for the file: https://docs.python.org/3.6/library/pdb.html#pdbcommand-list

To escape the pdb command, you can call it like this:

(Pdb) !list(newdict.keys())
scene_contra
  • 627
  • 4
  • 6