How/why do we use operator.abs

前端 未结 1 1691
野的像风
野的像风 2021-01-13 19:22

In operators module we have a helper method operator.abs. But in python abs is already a function, and the only way I know to invoke

相关标签:
1条回答
  • 2021-01-13 20:07

    abs(...)
        abs(a) -- Same as abs(a).

    No, I don’t think there’s some other fancy way you don’t know about, or really any reason at all for this to be here at all except for consistency (since operator has methods for the other __operator__s).

    0 讨论(0)
提交回复
热议问题