[issue1413] int literal methods inaccessible

Christian Heimes report at bugs.python.org
Fri Nov 9 21:46:28 CET 2007


Christian Heimes added the comment:

> I don't understand why 1.j is 1j .. because there's no int.j .. why then
> 1.L is not 1L ?

Complex numbers from the number domain |C which supersets |R. Complex
numbers are usually implemented and viewed as 2d vectors made from two
floating numbers real and img.

A long or long int however is from number domain |Z which doesn't allow
fraction and hence no '.', too.

It should explain why 1.L is illegal but 1.j is 1.0 * 1j.

> .. however, fixing this is not necessary - because no one would
> probably use it, it's just a syntax inconsistency

I don't if it's possible to fix the problem with Python's parser.
However the inconsistency should be documented. Is it explained in the
docs and do the docs also mention the (1).__attr__ trick? I wasn't aware
that it works.

Christian

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1413>
__________________________________


More information about the Python-bugs-list mailing list