Y
Hacker News
new
|
ask
|
show
|
jobs
by
ngkabra
5288 days ago
At 12 characters, this is definitely not the shortest, but it is a totally different approach than the other solutions:
>>> f = lambda: g()if 0 else(1) >>> f() 1
1 comments
jerfelix
5288 days ago
Creative solution! You can knock it down a character by removing the "1" and simply returning an empty tuple.
>>> f = lambda: g()if 0 else() >>> f() ()
link