Hacker News new | ask | show | jobs
by cogs 339 days ago
Simple use case: What version of the json module is this live code running? (when you don't even know the attribute name)

# At a pdb prompt, from a frame where json is global or local:

  (Pdb) import pobshell; pobshell.shell()

  Welcome to Pobshell - type 'help' for commands, 'quit' to exit 
  / ▶ find json --name *version* -i -a -l
  /json/__version__  str                       '2.0.9'                                                  
  /json/codecs/sys/api_version  int                       1013                                           
  /json/codecs/sys/hexversion  int                       51055600                                       
  /json/codecs/sys/version  str                       '3.11.11 | packaged by  

  # -i case insensitive
  # -a include hidden attributes (_ and __ prefixed names)
  # -l give an 'ls -l' listing of the matched objects