what do you want to do with a null pointer (AFAIK you get the error only if you call one of the member functions)? Same thing as with None, it is only useful in predicates?
Null pointers have been given types in order for overloads based on them to work properly. E.g.:CallMyFunc( f.Get('RunInfo') )now works as expected.
that’s a FAQ … Never, ever do “is None” in a predicate unless you really need it to be None and nothing else (is in the python coding standards). Always do:[code]if not f.Get(‘RunInfo’):
do something[/code]Note that ‘== None’ would work as well (but is not recommended either).
yes, if what you need is “Testing for None” (as per that PEP, i.e. if it needs to be None and nothing but None), then ‘is None’ is the way to go. For example, if None is a default value for a function argument and the code needs to figure out whether that value was changed.
Unfortunately the fact was that in older PyROOT versions the return value in these cases was None, and so testing ‘x is None’ was perfectly sensible. Changing from None to something else (though I understand the reason) is an API change which can introduce subtle bugs. Now I get to spend the afternoon looking through the ATLAS DQ code to make sure we don’t trigger it…
yes, but only for return values of functions: it has never been true across the board that Python None is C++ NULL as the semantics of the two are way too different.