Bug? ( () == [] ) != ( ().__eq__([]) )

Ian Kelly ian.g.kelly at gmail.com
Mon Aug 5 11:08:07 EDT 2013


On Mon, Aug 5, 2013 at 8:58 AM, Markus Rother <markus.rother at web.de> wrote:
> Thanks for the good explanation.
>
> My intention was to pass a custom method/function as a comparator
> to an object.  My misconception was, that __eq__ is equivalent to
> the '==' operator, and could be passed as a first class function.
> Apparently, that is not possible without wrapping the comparison
> into another function/method.

The operator.eq function is equivalent to the == operator.  Use that.



More information about the Python-list mailing list