[Python-checkins] cpython (2.7): Closes #9574: Note that complex constructor doesn't allow whitespace around

mark.dickinson python-checkins at python.org
Sat Mar 10 17:15:38 CET 2012


http://hg.python.org/cpython/rev/5a3c89337b50
changeset:   75517:5a3c89337b50
branch:      2.7
parent:      75500:f8efcca7e90f
user:        Mark Dickinson <mdickinson at enthought.com>
date:        Sat Mar 10 16:09:35 2012 +0000
summary:
  Closes #9574: Note that complex constructor doesn't allow whitespace around central operator.

files:
  Doc/library/functions.rst |  7 +++++++
  1 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -247,6 +247,13 @@
    the function serves as a numeric conversion function like :func:`int`,
    :func:`long` and :func:`float`.  If both arguments are omitted, returns ``0j``.
 
+   .. note::
+
+      When converting from a string, the string must not contain whitespace
+      around the central ``+`` or ``-`` operator.  For example,
+      ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` raises
+      :exc:`ValueError`.
+
    The complex type is described in :ref:`typesnumeric`.
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list