Wrong info on complex()

Bug #804576 reported by gpk
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pychecker (Ubuntu)
New
Undecided
Unassigned
python-defaults (Ubuntu)
New
Undecided
Unassigned

Bug Description

Running pychecker on the code below incorrectly yields an error. In fact, complex() is perfectly happy without any arguments.

$ cat foo.py

def foo():
 return complex()
$
$ pychecker foo.py
Processing module foo (foo.py)...

Warnings...

foo.py:3: Invalid arguments to (complex), got 0, expected between 1 and 2
$

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: pychecker 0.8.19-1
ProcVersionSignature: Ubuntu 2.6.38-10.46-generic 2.6.38.7
Uname: Linux 2.6.38-10-generic x86_64
NonfreeKernelModules: fglrx
Architecture: amd64
Date: Fri Jul 1 23:36:29 2011
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Beta amd64 (20100901.1)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_GB:en
 PATH=(custom, user)
 LANG=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: pychecker
UpgradeStatus: Upgraded to natty on 2011-04-30 (62 days ago)

Revision history for this message
gpk (gpk-kochanski) wrote :
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for reporting this issue and helping to make Ubuntu better.

I see the same result with your example with pychecker 0.8.19-6 on Ubuntu Raring. As I haven't used complex() before, I decided to check the documentation to see how many arguments it really require. However, I found conflicting information. According to python.org [1], the signature is complex([real[, imag]]). However, pydoc complex will list the following signature:
class complex(object)
 | complex(real[, imag]) -> complex number

In other words, one have only optional arguments, while the second require at least one argument and has an optional second one. I have not verified this, but I would believe pychecker checks the signature of the method in the same place pydoc gets it from. The question then is why do they differ, and which is the correct one?

[1] http://docs.python.org/2/library/functions.html#complex

tags: added: precise quantal raring
removed: natty
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.