This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients corona10, eric.smith, serhiy.storchaka
Date 2020-05-31.11:23:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1590924231.42.0.852280265585.issue40825@roundup.psfhosted.org>
In-reply-to
Content
There is PyNumber_Check(). It is not direct analog of isinstance(obj, numbers.Number), it checks that the object can be explicitly converted to the real number (int or float). UUID and IPv4Address pass this check.

As a narrow check we can use isinstance(obj, (str, int, float)). It does not accept Fraction, Decimal and numpy numbers, but it is what such modules like json or plistlib accept.
History
Date User Action Args
2020-05-31 11:23:51serhiy.storchakasetrecipients: + serhiy.storchaka, eric.smith, corona10
2020-05-31 11:23:51serhiy.storchakasetmessageid: <1590924231.42.0.852280265585.issue40825@roundup.psfhosted.org>
2020-05-31 11:23:51serhiy.storchakalinkissue40825 messages
2020-05-31 11:23:51serhiy.storchakacreate