> >>> 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! :) Thanks for all the insight, - kcrisman --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---