[Python-ideas] Allow attribute references for decimalinteger

MRAB python at mrabarnett.plus.com
Thu Oct 31 03:06:35 CET 2013


On 31/10/2013 01:55, אלעזר wrote:
> [MRAB‏]
>> it's already the case> that 1.j == 1.0j, not (1).j, so saying that 1.real == (1).real would be inconsistent.
>
> I don't understand. In what sense 1.j != (1).j ? The latter is an
> AttributeError, which I suggest to change.
>
Ah, I see what you mean.

-1

I don't like the idea of a float or int having its imaginary equivalent
as an attribute. It just feels 'wrong' to me!

> [Alexander Belopolsky]
>> What would 1.e50 mean under your proposal?
>
> Well that seems to kill it :-(. I should have digged deeper before
> proposing this idea.
>
> I assume it's fixable by making it a special syntax itself, or by
> raising an AttributeError (I really doubt it appears anywhere) or by
> making int's __getattribute__ handle it in a special way, but I
> wouldn't suggest these ideas seriously.
>
> The docs should mention this issue, however. perhaps in an end note.
>



More information about the Python-ideas mailing list