Re:Working at Netflix
by SilasX on Wednesday January 21, 2015 @10:27AM
(#8923456)
When first learning python (Shaw's The Hard Way maybe), it suggested this idiom as python's ternary operator:
boolean and true_branch or false_branch
and explained that boolean=true would make it check and return true_branch, while false makes it check the other side of the or.
This is parallel to the standard C one. I'm surprised no one has mentioned it, but I guess that makes sense because it's not very explicit about what it's doing, which goes agains the spirit of python. Probably not very common for python programmers to use.
This is parallel to the standard C one. I'm surprised no one has mentioned it, but I guess that makes sense because it's not very explicit about what it's doing, which goes agains the spirit of python. Probably not very common for python programmers to use.