On Mon, May 4, 2009 at 11:13 AM, kcrisman <kcris...@gmail.com> wrote:
>
>> >>> I assume this is known, but I am wondering whether it should be
>> >>> treated as a bug,
>>
>> >> This is not a bug.  It's a stupid design decision in Python, which we
>
> Right, I knew that Python ints behaved this way, I was just surprised
> that somehow in Sage / didn't change this - I guess it's because most
> integer input gets preparsed to Integer, right?
>
>> >> Trust me, I understand that Python's int floor division sucks.   I'm
>> >> teaching undergrads about stats using Sage now, and the most obvious
>> >> line of code to compute the mean of a list gets the answer totally
>> >> wrong because of this problem.  This already caused a lot of
>> >> confusion.
>
> Luckily I haven't had that problem - just my own getting weird answers
> just now!
>
>> > Good point, I hadn't though about that. We could introduce a size()
>> > or cardinality() method that returns an Integer, or possibly infinity.
>
> That sounds useful; there are already other things that have
> cardinality() implemented, right?
>
>> We could also redefine len.
>
> I'm not touching that one! :)

Well it's really just random chance that I didn't redefine len in
sage.all back in 2005. If I had, then len would likely still be
redefined now and we wouldn't be having this conversation.  I'm not
sure this isn't a good idea.  I just don't know.   It's a question of
pros versus cons, and so far I see more pros than cons.

 -- William

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

Reply via email to