@@ -255,6 +255,31 @@ number and the following identities hold (assuming ``x`` and ``y`` are
255255 repr (complex (x, y)) == repr (x + y* 1j )
256256
257257
258+ Imaginary and complex numbers will have disinct string representations:
259+
260+ .. code :: python
261+
262+ repr (complex (x, y)) = (" ("
263+ + format (x, " .0f" if x and x.is_integer() else " " )
264+ + (" +" if math.copysign(1 , y) == 1 else " " )
265+ + repr (y* 1j ) + " )" )
266+ repr (x* 1j ) = (repr (x) + " j" ).replace(" .0j" , " j" )
267+
268+ Parsing strings with the integer "negative zero" in real part (i.e. ``"-0+1j" ``
269+ or ``"(-0+1j)" ``) will be deprecated in the :external+py3.14:class: `complex `
270+ constructor.
271+
272+ The :mod: `marshal ` module will be adjusted to support new type.
273+
274+ The :func: `ast.literal_eval ` and :func: `compile ` will reject non-imaginary
275+ complex values for :class: `ast.Constant ` node type, e.g.
276+ ``ast.Constant(value=1+2j) `` (now permitted).
277+
278+
279+ Complex Arithmetic
280+ ------------------
281+
282+
258283The tables below define unary operations, additive operators (binary ``+ `` and
259284``- ``) and multiplicative operators (``* `` and ``/ ``) for all possible
260285combinations of types (integer operand values will be implicitly converted to
@@ -353,27 +378,6 @@ all real, imaginary, and complex operands:
353378 operand is a zero, then the result of the ``/ `` operator is an infinity.
354379
355380
356- Imaginary and complex numbers will have disinct string representations:
357-
358- .. code :: python
359-
360- repr (complex (x, y)) = (" ("
361- + format (x, " .0f" if x and x.is_integer() else " " )
362- + (" +" if math.copysign(1 , y) == 1 else " " )
363- + repr (y* 1j ) + " )" )
364- repr (x* 1j ) = (repr (x) + " j" ).replace(" .0j" , " j" )
365-
366- Parsing strings with the integer "negative zero" in real part (i.e. ``"-0+1j" ``
367- or ``"(-0+1j)" ``) will be deprecated in the :external+py3.14:class: `complex `
368- constructor.
369-
370- The :mod: `marshal ` module will be adjusted to support new type.
371-
372- The :func: `ast.literal_eval ` and :func: `compile ` will reject non-imaginary
373- complex values for :class: `ast.Constant ` node type, e.g.
374- ``ast.Constant(value=1+2j) `` (now permitted).
375-
376-
377381New C API
378382---------
379383
0 commit comments