[Python-Dev] "result type only depends on operand types"...?
Aahz
aahz@pythoncraft.com
Sun, 31 Mar 2002 12:52:09 -0500
On Sun, Mar 31, 2002, Alex Martelli wrote:
>
> Back on March 10 in the thread on PEP 285 Guido wrote:
>
> """
> This is a very general rule that I like a lot: that the type of a
> result should only depend on the type of the arguments, not on their
> values. I expect that this rule will make reasoning about programs
> (as in PsyCo or PyChecker) easier to do.
> """
>
> And yet...:
>
> >>> type(2**10)
> <type 'int'>
> >>> type(2**100)
> <type 'long'>
>
> ...doesn't this apply to many operators on ints in 2.2? Yet _another_
> (set of) exception(s) with practicality beating purity? Perhaps, but if a
> "very general rule" has so many exceptions in frequent and fundamental
> cases, is it a rule at all...?
Channeling Guido: this isn't an "exception", this is a phased step in
the progress toward unifying ints and longs. Eventually, the
distinction will go away except for explicitly declared platform ints,
and an overflow error on a platform int will once again raise an
exception rather than transforming automatically.
--
Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/
Why is this newsgroup different from all other newsgroups?