Mind: I said "a pain in the arse", not "impossible". And i think not only about the writing (writing such things regularly is not what any programmer would want to do), but also the debugging perspective.
What you have done there is cute and commendable as a mental exercise, but if i'd ever encounter that in production code someone would make a close encounter with my chainsaw. This is basically undebuggable (i don't know the line/statement debuggers python has available, so i'm guessing here at what happens) because either the debugger will step over that in one step because it's one statement, or it'll just keep stepping on the same line again and again which is also entirely useless.
Lastly, what you did there is basically golf the living hell out of that code to bring it down from multiple statement lines to a single one. If i have to reach to such means i might as well use Perl. Only Perl actually does allow me to put multiple statement subs into a lambda, so i don't have to golf there.
Weird days when i have to golf in Python but don't need to in Perl.
Comments
Mind: I said "a pain in the arse", not "impossible". And i think not only about the writing (writing such things regularly is not what any programmer would want to do), but also the debugging perspective.
What you have done there is cute and commendable as a mental exercise, but if i'd ever encounter that in production code someone would make a close encounter with my chainsaw. This is basically undebuggable (i don't know the line/statement debuggers python has available, so i'm guessing here at what happens) because either the debugger will step over that in one step because it's one statement, or it'll just keep stepping on the same line again and again which is also entirely useless.
Lastly, what you did there is basically golf the living hell out of that code to bring it down from multiple statement lines to a single one. If i have to reach to such means i might as well use Perl. Only Perl actually does allow me to put multiple statement subs into a lambda, so i don't have to golf there.
Weird days when i have to golf in Python but don't need to in Perl.