Python C API: omitted variable assignment causes unexpected behaviour
问题 While using python with pyroot (a python interface to a CERN data analysis package named ROOT), I encountered the following strange behaviour: print ROOT.TFile(fname).GetListOfKeys() outputs None while the seemingly semantically equivalent code f=ROOT.TFile(fname) print f.GetListOfKeys() outputs the expected <ROOT.THashList object ("THashList") at 0x13f0fa0> . While this is hardly the first bug I have encountered while working with ROOT, this time I am quite puzzled that python allows this