nullpointerexception

Safe dereferencing in Python

Safe dereferencing in Python Question: Groovy has a nice operator for safe dereferencing, which helps to avoid NullPointerExceptions: variable?.method() The method will only be called, if variable is not null. Is there a way to do the same in Python? Or do I have to write if variable: variable.method()? Asked By: deamon || Source Answers: …

Total answers: 7