While playing around with true & floor division in Py3k... Python 3.0a4+ (py3k:62126, Apr 3 2008, 16:28:40) [GCC 4.1.2 20070626 (Red Hat 4.1.2-13)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x=2+0j >>> y=3+0j >>> x / y (0.66666666666666663+0j) >>> x//y Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't take floor of complex number. >>> x.__floordiv__(y) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't take floor of complex number. >>> x.__divmod__(y) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't take floor or mod of complex number.
In Python2.5, [EMAIL PROTECTED] py3k]$ python2.5 Python 2.5.1 (r251:54863, Sep 6 2007, 17:27:08) [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> x=2+0j >>> y=3+0j >>> x/y (0.66666666666666663+0j) >>> x//y __main__:1: DeprecationWarning: complex divmod(), // and % are deprecated 0j >>> x.__floordiv__(y) 0j >>> x.__divmod__(y) (0j, (2+0j)) Shouldn't Py3k also return 0j for floor division ? If it does not want to do floor division/divmod for complex numbers, shouldn't the exception error be more descriptive ? Or is this the expected behavior ? Thanks -- -Anand _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com