Is is possible to return from a method in single line in python
Looking for something like this
return None if x is None
Tried abov
Yes, it's called a conditional expression:
return None if x is None else something_else
You need an else something in a conditional for it to work.
else something