3 ms·
Agreed. It could be written much more clearly in my opinion like this: [varname] = [x for x in l if predicate_with_single_truth_value(x)]
by almost 14y ago
Agreed. It could be written much more clearly in my opinion like this:
[varname] = [x for x in l if predicate_with_single_truth_value(x)]
- Estragon 14y agoGood idea!
- euccastro 14y agoI had to check that on the REPL. I'm surprised that even works and I can't think of a good reason why should list syntax be allowed as a lvalue, in addition to tuple syntax.
- Estragon 14y agoIt's called destructuring assignment. It's been around for a while. http://dunsmor.com/lisp/onlisp/onlisp_22.html http://dunsmor.com/lisp/onlisp/onlisp_22.html