#11779: python ints vs sage ints with respect to powers weirdness
------------------------+---------------------------------------------------
Reporter: dimpase | Owner: AlexGhitza
Type: defect | Status: needs_review
Priority: major | Milestone: sage-4.7.2
Component: coercion | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: Dmitrii Pasechnik
Merged: | Dependencies:
------------------------+---------------------------------------------------
Comment(by leif):
Replying to [comment:15 dimpase]:
> Leif here gives arguments based on algebraic properties, so it should
be, for algebraic consistency that he cares about so much, that
{{{int(3)^-3==int(1)/int(3)^3}}}, but this is
> not the case now, as Python 2 will convert 1/27 to 0.
What makes you think I meant Python's broken `/` operator on `int`s? As I
said on sage-devel, the behaviour of that operator on `int`s is useless
since there's explicit truncating integer division already, namely `//`.
> I advocate the rule that a binary operation involving a Sage integer and
a Python int should always produce a Sage type, as this is the case with
all the other binary operations.
The notion of "binary operations" has no meaning in this context, as the
desired behaviour w.r.t. result types should depend on the definition of
the function, especially its commonly used signature, not its arity.
For exponentiation, the ''type'' of the exponent is irrelevant, only its
''value'' matters to deduce the type of the result of the operation, just
like for shift operations (which of course aren't commutative either).
Or would you say `type( value << shift )` should depend on the type of
`shift`?
This might perhaps look "consistent" from a syntactical point of view, but
simply isn't sound, i.e. doesn't make any sense in the semantic domain.
> To me, your and Leif's arguments read as "I prefer the status quo to
making Sage a more consistent system".
Definitely not, since there are a lot of inconsistencies already which
should IMHO be fixed, but not in the way you propose.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11779#comment:16>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.