[New-bugs-announce] [issue34049] abs() method accept argument that implement __abs__()

Windson Yang report at bugs.python.org
Thu Jul 5 02:44:31 EDT 2018


New submission from Windson Yang <wiwindson at gmail.com>:

Just like callable() method in https://docs.python.org/3/library/functions.html#callable

> ...instances are callable if their class has a __call__() method.

I think we should also mention this in abs(),

abs(x)
Return the absolute value of a number. If x defines __abs__, abs(x) returns x.__abs__(). The argument may be an integer or a floating point number. If the argument is a complex number, its magnitude is returned.

----------
components: Library (Lib)
messages: 321080
nosy: Windson Yang
priority: normal
severity: normal
status: open
title: abs() method accept argument that implement __abs__()
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34049>
_______________________________________


More information about the New-bugs-announce mailing list