On Tuesday, 6 September 2011 13:01:53 UTC+8, leif wrote:
>
> On 6 Sep., 06:36, Dima Pasechnik <dim...@gmail.com> wrote: 
> > On Tuesday, 6 September 2011 11:08:02 UTC+8, leif wrote: 
> > 
>
[...] 

>
>
> Of course int(n)^-k should be int(1)/int(n)^k, yielding either a 
> Python int or float, to stay "pythonic", or, more precisely, within 
> Python types. 
>

In Python 2, int(1)/int(m) is either 0 or 1, so, what are you talking about?
Do you propose to change how Python 2 behaves?

 

>
> > (unless you want to stay Pythonic, and get int(1)/int()^k, i.e. 0 in 
> Python 
> > 2, which would be 
> > even more stupid than the current conversion into float) 
>
> I consider this just a Python "bug" (perhaps inherited from early bad 
> design), since Python (now) does have explicit integer / truncating 
> division, a // b.


how does this help?
$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 1//3
0
>>> 

indeed, one can do 
>>> from __future__ import division
>>> 1/3
0.33333333333333331

bu this is beside the point. 
 

>
>
>
> > Now, as int()^-k should to be Integer, so should be int()^k, too. 
>
> The former shouldn't, so the latter shouldn't either. ;-) 
>
>
it shouldn't in your imagination only, but not in present Sage's Python.

Dima
 

>
> -leif 
>

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to