How about adding rational fraction to Python?
D'Arcy J.M. Cain
darcy at druid.net
Thu Feb 28 11:13:27 EST 2008
On Thu, 28 Feb 2008 10:39:51 -0000
"Steven D'Aprano" <steve at REMOVE-THIS-cybersource.com.au> wrote:
> On Thu, 28 Feb 2008 00:30:11 -0800, Dennis Lee Bieber wrote:
> > Automatic conversions, okay... but converting a result when all
> > inputs are of one time, NO...
>
> What? How does that make any sense?
>
> By that logic, we should see this:
>
> >>> len("a string")
> '8'
> >>> len([2, 4, 6])
> [3]
> >>> len({'key': 'value'})
> {1: None}
I think that you have to show your work here. How does the above
statement about operators imply that the len method should return the
type of its argument?
> > The only rule needed is very simple: promote simpler types to the
> > more complex type involved in the current expression (with expression
> > defined as "value operator value" -- so (1/2) * 3.0 is INTEGER 1/2,
> > resultant 0 then promoted to float 0.0 to be compatible with 3.0).
> >
> > Very simple rule, used by very many traditional programming
> > languages.
>
> And rightly rejected by many other programming languages, including
> modern Python, not to mention calculators, real mathematics and common
> sense.
Lost me again. I was not aware that calculators, real mathematics and
common sense were programming languages. Check out the definition in
http://en.wikipedia.org/wiki/Programming_language and others if you are
unclear. PLs are designed to communicate with machines. Even a
calculator is an application, not a language. This is an important
difference.
--
D'Arcy J.M. Cain <darcy at druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list
mailing list