diff options
author | Fred Drake <fdrake@acm.org> | 2001-12-13 19:52:22 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-12-13 19:52:22 (GMT) |
commit | 526c7a0101d826fdab8b1ef5a757e1eae351687c (patch) | |
tree | fe3c026e4862df026da3aa91eba621e19f29877c /Doc | |
parent | 733c8935f9dfd1be70c472649eb845ea22bbc878 (diff) | |
download | cpython-526c7a0101d826fdab8b1ef5a757e1eae351687c.zip cpython-526c7a0101d826fdab8b1ef5a757e1eae351687c.tar.gz cpython-526c7a0101d826fdab8b1ef5a757e1eae351687c.tar.bz2 |
Ensure that complex() only accepts a string argument as the first arg,
and only if there is no second arg.
This closes SF patch #479551.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libfuncs.tex | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex index a750875..17c1722 100644 --- a/Doc/lib/libfuncs.tex +++ b/Doc/lib/libfuncs.tex @@ -159,12 +159,14 @@ def my_import(name): \begin{funcdesc}{complex}{real\optional{, imag}} Create a complex number with the value \var{real} + \var{imag}*j or - convert a string or number to a complex number. + convert a string or number to a complex number. If the first + parameter is a string, it will be interpreted as a complex number + and the function must be called without a second parameter. The + second parameter can never be a string. Each argument may be any numeric type (including complex). If \var{imag} is omitted, it defaults to zero and the function serves as a numeric conversion function like \function{int()}, - \function{long()} and \function{float()}; in this case it also - accepts a string argument which should be a valid complex number. + \function{long()} and \function{float()}. \end{funcdesc} \begin{funcdesc}{delattr}{object, name} |