How about adding rational fraction to Python?

Lie Lie.1296 at gmail.com
Tue Feb 26 11:33:32 EST 2008


On Feb 26, 9:33 pm, Marc 'BlackJack' Rintsch <bj_... at gmx.net> wrote:
> On Tue, 26 Feb 2008 04:29:18 -0800, Lie wrote:
> >> J Cliff Dyer:
> >> I'm in the camp that believes that 3/4 does indeed yield the integer 0,
> >> but should be spelled 3//4 when that is the intention.
>
> > That's creepy for people that are new to programming and doesn't know
> > how CPUs work and are used to general mathematics. That means most
> > people. As programming language are now more accessible to regular
> > people without specialized Computer Science degree, it is a just
> > natural trend that computer arithmetic must be done in an expectable
> > manner as seen by those general population not by people who holds a
> > CS degree.
>
> So why is it creepy then!?  ``3 // 4`` is for the people knowing about
> integer division and ``3 / 4`` gives the expected result for those who
> don't.  Those who don't know ``//`` can write ``int(3 / 4)`` to get the
> same effect.

yep, that's the point. The new division operator isn't that creepy
anymore by returning float instead of integer, kudos for whoever made
the change.



More information about the Python-list mailing list