How about adding rational fraction to Python?
Dan Bishop
danb_83 at yahoo.com
Fri Feb 29 21:36:29 EST 2008
More information about the Python-list mailing list
Fri Feb 29 21:36:29 EST 2008
- Previous message (by thread): How about adding rational fraction to Python?
- Next message (by thread): How about adding rational fraction to Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Feb 29, 12:55 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote: > On Thu, 28 Feb 2008 10:39:51 -0000, Steven D'Aprano > <st... at REMOVE-THIS-cybersource.com.au> declaimed the following in > comp.lang.python: > > > By that logic, we should see this: > > > >>> len("a string") > > '8' > > Why? len() is a function that /counts/ the elements of the argument > -- said count remains in integral value (I presume we don't have a 1.5 > character long string) The relevant point is that len() is a function that returns a DIFFERENT type than its argument, and nobody ever complains about is. > > And rightly rejected by many other programming languages, including > > modern Python, not to mention calculators, real mathematics and common > > sense. > > I know of no calculator that has "integers" for normal math -- and > the HP50 even emphasizes this by putting a decimal point into "integer" > quantities. Heck -- most calculators work in BCD floats. Most merely > suppress the decimal point if the trailing digits are all 0s My TI-89 treats them differently: 1.0/2.0 is 0.5, while 1/2 is the symbolic expression 1/2.
- Previous message (by thread): How about adding rational fraction to Python?
- Next message (by thread): How about adding rational fraction to Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list