]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-109218: Improve documentation for the complex() constructor (GH-119687)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 30 May 2024 20:20:07 +0000 (23:20 +0300)
committerGitHub <noreply@github.com>
Thu, 30 May 2024 20:20:07 +0000 (20:20 +0000)
commitec1ba264607b2b7b98d2602f5536a1d02981efc6
tree6803200390bd836aa0841cc5f35971fedcebef9f
parent1c04c63ced5038e8f45a2aac7dc45f0815a4ddc5
gh-109218: Improve documentation for the complex() constructor (GH-119687)

* Remove the equivalence with real+imag*1j which can be incorrect in corner
  cases (non-finite numbers, the sign of zeroes).
* Separately document the three roles of the constructor: parsing a string,
  converting a number, and constructing a complex from components.
* Document positional-only parameters of complex(), float(), int() and bool()
  as positional-only.
* Add examples for complex() and int().
* Specify the grammar of the string for complex().
* Improve the grammar of the string for float().
* Describe more explicitly the behavior when real and/or imag arguments are
  complex numbers. (This will be deprecated in future.)
Doc/library/cmath.rst
Doc/library/functions.rst
Objects/clinic/complexobject.c.h
Objects/complexobject.c