◐ Shell
clean mode source ↗

gh-84978: Add float.from_number() and complex.from_number() by serhiy-storchaka · Pull Request #26827 · python/cpython

They are alternate constructors which only accept numbers
(including objects with special methods __float__, __complex__
and __index__), but not strings.

@serhiy-storchaka

@serhiy-storchaka

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka changed the title bpo-40801: Add float.from_number() and complex.from_number() gh-84978: Add float.from_number() and complex.from_number()

Oct 14, 2023

skirpichev added a commit to skirpichev/cpython that referenced this pull request

Oct 17, 2023
Taken from python#26827

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>

mdickinson

Co-authored-by: Mark Dickinson <dickinsm@gmail.com>

estyxx pushed a commit to estyxx/cpython that referenced this pull request

Jul 17, 2024
…thonGH-26827)

They are alternate constructors which only accept numbers
(including objects with special methods __float__, __complex__
and __index__), but not strings.