So yeah, we can "if <expression>: return", but why not?

Examples:

def some_function(a, b):
   return if a == b # That will return None
   return a * b
print(some_function(2,2)) # None
print(some_function(5,2)) # 10

def some_function_2(a, b):
   return if a > b or a == b
   return if a == 1 and b == 1
   return a*b
print(some_function_2(2,2)) # None
print(some_function_2(1,1)) # None
print(some_function_2(1,2)) # 2
print(some_function_2(5, 10)) # 50
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/575AK6VJN4VSSVZFCW7674YWEX45LRLN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to