In Python, I\'d like to write a function that would pretty-print its results to the console if called by itself (mostly for use interactively or for debugging). For the purpose
There's no use case for this. Python assigns all interactive results to a special variable named _
.
You can do the following interactively. Works great. No funny business.
>>> check_status()
{'cond_op': 1, 't_canoncharge': 1342, 'stage_booster': 5, 'range_est_sigma': 0.023, 'fuel_est': 32557154, 'beer_type': 31007, 'beer_temp': 2, 'catchphrase_suggestion': 1023, 'virtual_on': 'hell yes'}
>>> pprint.pprint( _ )
{'beer_temp': 2,
'beer_type': 31007,
'catchphrase_suggestion': 1023,
'cond_op': 1,
'fuel_est': 32557154,
'range_est_sigma': 0.023,
'stage_booster': 5,
't_canoncharge': 1342,
'virtual_on': 'hell yes'}