On Fri, Jul 12, 2013 at 2:53 PM, Alexander Belopolsky
email@example.com wrote: >
On Fri, Jul 12, 2013 at 10:54 AM, Barry Warsaw firstname.lastname@example.org wrote: >
(Independent of this idea, it would actually be nice if the operator module had a dictionary mapping from op symbols to names, like operator.by_symbol["+="] giving operator.iadd)
...but this is a neat idea.
This is neat, but I don't really see much use beyond implementing things like fold("+=", ..) that you've just rejected.
I do somewhat agree that there may not be much place to use this in
the standard library, but I think it could make use of the operator
module a bit easier to read in some cases. For instance, it takes me
a second thought to correctly parse
operator.irshift as "right-shift
in-place" instead of "IR shift" (which may or may not mean anything,
but certainly doesn't in Python). On the other hand,
operator.get_op(">>=") shows what the returned function is going to