Created
April 27, 2012 15:08
-
-
Save bmispelon/2510022 to your computer and use it in GitHub Desktop.
A bit of golfing around empty sets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 'set' | |
| # can then be used with getattr(__builtins__, XXX)() | |
| # or, even simpler, eval(XXX)() | |
| ''.join(help.__doc__[i] for i in [35, 47, 71]) | |
| str(bool())[-2:] + str(bool(' '))[0].lower() | |
| (2 * '%s' % tuple(map(bool, range(2)))).lower()[3:6] | |
| ''.join(__import__('json').dumps(bool(x)) for x in range(2))[3:6] # not me | |
| # return 5 if passed nothing or a falsish value. | |
| # Return 4 otherwise | |
| reduce(lambda f, g: lambda *args: f(g(*args)), [len, str, bool])() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment