Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
PEP0238 lament
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 297 - Expand all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
arthur_siegel  
View profile  
 More options Jul 22 2001, 12:14 pm
Newsgroups: comp.lang.python
From: Arthur_Sie...@rsmi.com
Date: Sun, 22 Jul 2001 11:01:08 -0500
Local: Sun, Jul 22 2001 12:01 pm
Subject: PEP0238 lament
Before going further in attempting to contribute to the
discussions of Pep238  (or case sensitivty) allow
be to present my credentials.

None, to speak of.

Except that I've been through the program.  Guido's
program.  His language. His environment.  His
tutorials.  

I think with some success.

Participate little on python-list, because much of
what goes on is over my head.

But on the question of learning programming with
Python - as I mention, been through the program.

Here the issues are  under my nose, not
over my head.

I particpate actively on the edu-sig list, because
I understand my success could be other's success.
Am a big supporter of Guido's CP4E ideals.

Yet despite the gratitude I try to keep in mind,
I clash consistently with Guido on CP4E - sometimes
in unpleasant ways.  

Can only hope he appreciates at some level that I
bring some passion to the table on some common
goals.

Because that clash now spills over to the Python list.

Since I have convinced myself that not only do I
object to the rationale and evidence gathering behind
the integer division change - I am going to step up
and be arrogant enough to say that I am against it
as a design feature,  in light of the only aspect of Python
design about which I would dare to speak - CP4E goals.

3 / 4 = 0
3.0 / 4 = .75

Something important is going on here. I have a decent
understanding of what that is. Enough to get me by in
the real world.

I came to It -  having already understood that I would
only get so far if I expected it all to come to me.

That reckoning has been put off an hour ot two  for the
Python 2.2 learner, with a measurable cost.

Pity  for the Python2.2 learner.

Quite well realize that I am not  saying anything that
hasn't  been said before on the issue.

But disappointed to never have  heard the counter
argument from Guido - what put the issue over the
top for him?

If I was told that experinced programmers might
appreciate this change for any possible reason -
I'd be quiet as a mouse.

Since I remain convinced that the single most important
factor for Python's acceptance as an educational language is
the growth of its  acceptance as a professional language.

It will be interesting to see where Guido chooses to draw
the line on the thought process that lead him to his integer
division conclusion.

Which is the real issue - the integer division thing, stand-alone,
not likely to be a deal breaker for anyone.

Like to believe that there is more real world thinking
than Guido chooses to share publicly.

Alternatively,  I'm baffled as hell.

ART


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guido van Rossum  
View profile  
 More options Jul 22 2001, 12:22 pm
Newsgroups: comp.lang.python
From: Guido van Rossum <gu...@python.org>
Date: Sun, 22 Jul 2001 16:22:54 GMT
Local: Sun, Jul 22 2001 12:22 pm
Subject: Re: PEP0238 lament
Arthur Siegel and I seem to be pushing each other's buttons
constantly.  I don't know why it is, but ever post of his feels like a
flame or flamebait to me.  I always feel that he attacks me as a
person rather than attacking my arguments (usually because he claims
that I haven't given any arguments).  Try as I may, this makes it very
hard, almost impossible for me to respond in a meaningful manner to
Arthur's posts.  I wonder what I've done to tick him off.  I also
wonder how come he is so good at ticking me off.

The reason for wanting / to return a float (or at least a type that
can represent close approximations of numbers like 0.75) has been
discussed many times before.  The summary of the argument in the PEP
may not be complete, but I disagree with Arthur's assessment that
integer division is not a problem -- the VPython folks have ample
experience that it is.

Because all Arthur does is tick me off, I'll leave it at this -- maybe
someone else can explain it all to him.

--Guido van Rossum (home page: http://www.python.org/~guido/)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rainy  
View profile  
 More options Jul 22 2001, 1:45 pm
Newsgroups: comp.lang.python
From: s...@optonline.net (Rainy)
Date: Sun, 22 Jul 2001 17:40:10 GMT
Local: Sun, Jul 22 2001 1:40 pm
Subject: Re: PEP0238 lament

On Sun, 22 Jul 2001 11:01:08 -0500, Arthur_Sie...@rsmi.com <Arthur_Sie...@rsmi.com> wrote:

> If I was told that experinced programmers might
> appreciate this change for any possible reason -
> I'd be quiet as a mouse.

I don't think they will..

> Since I remain convinced that the single most important
> factor for Python's acceptance as an educational language is
> the growth of its  acceptance as a professional language.

First of all, it's really ugly. It's the ugliest thing in python for a newbie,
imho. Yes, 1/2 is 0. You have to type 1.0/2 to get 0.5. No, there is no good
reason for that, just memorize it. Ugh.

If it was just a matter of that, it wouldn't be enough for a change (non-
backwards-compatible one). But, the problem is that people will have strange
bugs because of this and spend hours upon hours trying to figure out what's
wrong. Python may be around during next 10-20 years and userbase may grow
a thousandfold, and having this ugliness on board for all this time is a
big problem.

It's arguable whether the problem is serious enough to break old code, but it's
obvious (to me, anyway) that there *is* a rather big problem here.

--
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: http://silmarill.org/cymbaline


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Guido van Rossum  
View profile  
 More options Jul 22 2001, 2:01 pm
Newsgroups: comp.lang.python
From: Guido van Rossum <gu...@digicool.com>
Date: Sun, 22 Jul 2001 13:20:15 -0400
Local: Sun, Jul 22 2001 1:20 pm
Subject: Re: PEP0238 lament

> I just reread the PEP at

>     http://python.sourceforge.net/peps/pep-0238.html

> It looks like it hasn't been updated since March.  I see no support for the
> argument that the current integer division semantics are confusing, only a
> claim that the current semantics are a problem.  Perhaps there's a more
> recent version of the PEP available that hasn't been released to the
> website.

Skip,

I've asked Moshe today to update the rationale based on the discussion
in c.l.py.  He said he would.  So just be patient.

--Guido van Rossum (home page: http://www.python.org/~guido/)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Skip Montanaro  
View profile  
 More options Jul 22 2001, 2:01 pm
Newsgroups: comp.lang.python
From: Skip Montanaro <s...@pobox.com>
Date: Sun, 22 Jul 2001 12:11:09 -0500
Local: Sun, Jul 22 2001 1:11 pm
Subject: Re: PEP0238 lament

    Guido> The reason for wanting / to return a float (or at least a type
    Guido> that can represent close approximations of numbers like 0.75) has
    Guido> been discussed many times before.  The summary of the argument in
    Guido> the PEP may not be complete, but I disagree with Arthur's
    Guido> assessment that integer division is not a problem -- the VPython
    Guido> folks have ample experience that it is.

Guido,

I just reread the PEP at

    http://python.sourceforge.net/peps/pep-0238.html

It looks like it hasn't been updated since March.  I see no support for the
argument that the current integer division semantics are confusing, only a
claim that the current semantics are a problem.  Perhaps there's a more
recent version of the PEP available that hasn't been released to the
website.

--
Skip Montanaro (s...@pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Moshe Zadka  
View profile  
 More options Jul 22 2001, 3:01 pm
Newsgroups: comp.lang.python
From: Moshe Zadka <mos...@zadka.site.co.il>
Date: Sun, 22 Jul 2001 21:40:49 +0300
Local: Sun, Jul 22 2001 2:40 pm
Subject: Re: PEP0238 lament

On Sun, 22 Jul 2001 12:11:09 -0500, Skip Montanaro <s...@pobox.com> wrote:
> Guido,

> I just reread the PEP at

>     http://python.sourceforge.net/peps/pep-0238.html

> It looks like it hasn't been updated since March.  I see no support for the
> argument that the current integer division semantics are confusing, only a
> claim that the current semantics are a problem.  Perhaps there's a more
> recent version of the PEP available that hasn't been released to the
> website.

Not really. I'm working on the PEP, and hopefully there will be a
new version tommorow with some more meat.
--
gpg --keyserver keyserver.pgp.com --recv-keys 46D01BD6 54C4E1FE
Secure (inaccessible): 4BD1 7705 EEC0 260A 7F21  4817 C7FC A636 46D0 1BD6
Insecure (accessible): C5A5 A8FA CA39 AB03 10B8  F116 1713 1BCF 54C4 E1FE

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Peters  
View profile  
 More options Jul 22 2001, 3:01 pm
Newsgroups: comp.lang.python
From: "Tim Peters" <tim....@home.com>
Date: Sun, 22 Jul 2001 14:22:21 -0400
Local: Sun, Jul 22 2001 2:22 pm
Subject: RE: PEP0238 lament
[Arthur_Sie...@rsmi.com]

> ...
> If I was told that experinced programmers might
> appreciate this change for any possible reason -
> I'd be quiet as a mouse.

Not all experienced programmers agree.  At the last Python Conference, I
moderated a 40-some person group discussion on conceivable changes to
Python's numeric model, not advocating but keeping the participants from
killing each other <wink>.  The meaning of integer division wasn't the
focus, but naturally came up.  By show of hands, about 3/4ths of the
participants agreed that 3/4 should not return 0, but rather *something* x
such that x*4 had a better chance of being confused with 3 than with 0.
There was no consensus on exactly what 3/4 should return -- rational or HW
float or decimal float were the most popular alternatives.

It shouldn't be so hard to understand why.  The current integer division
loses information silently and without a trace.  Combined with that Python
is not a statically typed language, there's simply no telling what e.g.

def velocity(distance, time):
    return distance / time

will compute by inspection.  This isn't about esoteric user overloading of
"/", it's about ordinary arithmetic on builtin numeric types, and many
experienced Python programmers have testified over the years to being burned
in practice by stuff exactly that simple.

I expect that either way is easy enough to *teach*, but I don't accept ease
of teaching as a primary goal:  I'm much keener on semantics that, once
*learned*, are hard to forget or to stumble over.  Even if such semantics
are 100x harder to teach at first, fine by me:  you spend the rest of your
life living with the consequences.  I wish the definition of continuity were
easier to teach too, but that doesn't mean I'll settle for an easier
definition that doesn't actually work <wink>.

some-mice-are-surprised-when-thet-divide-up-the-cheese-and-
    cheese-mass-mysteriously-disappears-ly y'rs  - tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Moshe Zadka  
View profile  
 More options Jul 22 2001, 4:01 pm
Newsgroups: comp.lang.python
From: Moshe Zadka <mos...@zadka.site.co.il>
Date: Sun, 22 Jul 2001 22:05:17 +0300
Local: Sun, Jul 22 2001 3:05 pm
Subject: RE: PEP0238 lament
I'm the last person to avoid going off on a tangent.

On Sun, 22 Jul 2001 14:22:21 -0400, "Tim Peters" <tim....@home.com> wrote:
> I wish the definition of continuity were
> easier to teach too, but that doesn't mean I'll settle for an easier
> definition that doesn't actually work <wink>.

Here is one that is easier to teach, if you just reverse the order
of teaching calculus and first-order logic and basic set theory.

A function is continuous at c if, when embedding the world of Reals
into a saturated model (or, say, 2^{Beth_omega} saturated, if you
don't want to get into subtle assumptions), for every infinitesimal x,
f(c+x)-f(c) is an infintesimal.

Of course, you might think that teaching about saturation is hard --
well, it might be ;-)

i-always-blamed-cauchy-and-weirstrass-for-tormenting-the-world-
with-epsilons-and-deltas-ly y'rs, Z.
--
gpg --keyserver keyserver.pgp.com --recv-keys 46D01BD6 54C4E1FE
Secure (inaccessible): 4BD1 7705 EEC0 260A 7F21  4817 C7FC A636 46D0 1BD6
Insecure (accessible): C5A5 A8FA CA39 AB03 10B8  F116 1713 1BCF 54C4 E1FE


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Eppstein  
View profile  
 More options Jul 22 2001, 4:10 pm
Newsgroups: comp.lang.python
From: David Eppstein <eppst...@ics.uci.edu>
Date: Sun, 22 Jul 2001 13:07:02 -0700
Local: Sun, Jul 22 2001 4:07 pm
Subject: Re: PEP0238 lament
In article <mailman.995826216.11537.python-l...@python.org>,
 "Tim Peters" <tim....@home.com> wrote:

> By show of hands, about 3/4ths of the
> participants agreed that 3/4 should not return 0, but rather *something* x
> such that x*4 had a better chance of being confused with 3 than with 0.

Well then, float is a very bad choice for what to return, or then how do
we explain when 3/4 * 4 = 3 (exactly) but 3/10 * 10 != 10?

I would be a lot happier with integer / integer = rational (as in
Mathematica's programming lang), but float is just ugly.  It is turning
exact values (integers) into approximate ones (float) when I didn't tell it
to.  It's almost as bad as if integer subtraction always truncated to 16
bit values -- a lot of the time that would give sort of reasonable answers
but it's a gratuitous approximation where you didn't expect one.
--
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppst...@ics.uci.edu http://www.ics.uci.edu/~eppstein/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Eppstein  
View profile  
 More options Jul 22 2001, 4:10 pm
Newsgroups: comp.lang.python
From: David Eppstein <eppst...@ics.uci.edu>
Date: Sun, 22 Jul 2001 13:08:44 -0700
Local: Sun, Jul 22 2001 4:08 pm
Subject: Re: PEP0238 lament
In article <eppstein-03540D.13070222072...@news.service.uci.edu>,
 David Eppstein <eppst...@ics.uci.edu> wrote:

> Well then, float is a very bad choice for what to return, or then how do
> we explain when 3/4 * 4 = 3 (exactly) but 3/10 * 10 != 10?

Uh, of course I meant 3/10 * 10 != 3...
--
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppst...@ics.uci.edu http://www.ics.uci.edu/~eppstein/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Logajan  
View profile  
 More options Jul 22 2001, 4:29 pm
Newsgroups: comp.lang.python
From: James Logajan <Jam...@Lugoj.Com>
Date: Sun, 22 Jul 2001 13:29:45 -0700
Local: Sun, Jul 22 2001 4:29 pm
Subject: Re: PEP0238 lament

Tim Peters wrote:
> By show of hands, about 3/4ths of the
> participants agreed that 3/4 should not return 0, but rather *something* x
> such that x*4 had a better chance of being confused with 3 than with 0.
> There was no consensus on exactly what 3/4 should return -- rational or HW
> float or decimal float were the most popular alternatives.

This has probably already been brought up, but perhaps the problem lies not
with the "/" operator, but one step earlier in distinguishing the meaning
of:

x = 3
and
x = 3.

That is subtle difference that can cause quite different results later on.

Or, one may try to teach that when ALL arguments of an operator are in one
"set", such as the set of integers, then one must expect a result that is an
element from THAT set, not another set, such as the set of real numbers or
from the set of complex numbers. Set theory seems to be taught fairly early
on in math, I think.

It has been my observation that people can often quickly grasp and make use
of the common underlying general principles behind things after having seen
only a few examples, provided there is a CONSISTENT underlying principle. A
handful of general rules may be easier to teach than a collection of special
cases. So can and should Python adopt an underlying principle along the
lines where one can grasp the following pattern:

integer = integer operator integer
real = integer operator real
real = real operator integer
real = real operator real
complex = integer operator complex
...

I prefer a handful of general rules, and operators that obey them.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Max Francis  
View profile  
 More options Jul 22 2001, 4:30 pm
Newsgroups: comp.lang.python
From: Erik Max Francis <m...@alcyone.com>
Date: Sun, 22 Jul 2001 13:24:22 -0700
Local: Sun, Jul 22 2001 4:24 pm
Subject: Re: PEP0238 lament

David Eppstein wrote:
> I would be a lot happier with integer / integer = rational (as in
> Mathematica's programming lang), but float is just ugly.  It is
> turning
> exact values (integers) into approximate ones (float) when I didn't
> tell it
> to. It's almost as bad as if integer subtraction always truncated to
> 16
> bit values -- a lot of the time that would give sort of reasonable
> answers
> but it's a gratuitous approximation where you didn't expect one.

I agree.  It's turning an otherwise fairly strongly (but dynamically)
typed language on its head.  If I want type-changing operations, I'll do
them explicitly.

--
 Erik Max Francis / m...@alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Wretches hang that jurymen may dine.
\__/ Alexander Pope
    Esperanto reference / http://mirror/alcyone/max/lang/esperanto/
 An Esperanto reference for English speakers.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Peters  
View profile  
 More options Jul 22 2001, 5:01 pm
Newsgroups: comp.lang.python
From: "Tim Peters" <tim....@home.com>
Date: Sun, 22 Jul 2001 16:01:31 -0400
Local: Sun, Jul 22 2001 4:01 pm
Subject: RE: PEP0238 lament
[TIm]

> I wish the definition of continuity were easier to teach too, but that
> doesn't mean I'll settle for an easier definition that doesn't actually
> work <wink>.

[Moshe Zadka]

> Here is one that is easier to teach, if you just reverse the order
> of teaching calculus and first-order logic and basic set theory.

> A function is continuous at c if, when embedding the world of Reals
> into a saturated model (or, say, 2^{Beth_omega} saturated, if you
> don't want to get into subtle assumptions), for every infinitesimal x,
> f(c+x)-f(c) is an infintesimal.

> Of course, you might think that teaching about saturation is hard --
> well, it might be ;-)

Na, they always leave *some* of the foundations in intro calculus courses
fuzzy.  H. Jerome Keisler wrote a very good intro calculus text based on
non-standard analysis, unfortunately now out of print.  See

    http://www.math.wisc.edu/~keisler/books.html

for publication details.  He didn't try to explain the intricacies of model
theory, he just spelled out "the rules" for working with infinitesimals and
got on with it.  Huge steaming masses of epsilon-delta proofs were
conspicuous by absence, so he was able to get to "the interesting stuff" a
lot quicker that way.  A good feel for the flavor of the approach can be
gotten by skipping to the end ("Part IV: Turning Calculus into Algebra") of

    http://online.sfsu.edu/~brian271/nsa.pdf

and reading "~=" as "infinitely close to".

> i-always-blamed-cauchy-and-weirstrass-for-tormenting-the-world-
> with-epsilons-and-deltas-ly y'rs, Z.

i-personally-blame-guido-for-letting-it-stand<wink>-ly y'rs  - tim

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Justin Sheehy  
View profile  
 More options Jul 22 2001, 5:01 pm
Newsgroups: comp.lang.python
From: Justin Sheehy <jus...@iago.org>
Date: Sun, 22 Jul 2001 16:53:28 -0400
Local: Sun, Jul 22 2001 4:53 pm
Subject: Re: PEP0238 lament

s...@optonline.net (Rainy) writes:
> 1/2 is 0. You have to type 1.0/2 to get 0.5. No, there is no good
> reason for that, just memorize it. Ugh.

Of course there is a good reason for it.

It may not be a reason that you personally think is "good enough", but
that does not make it a random, arbitrary aspect of the language.

You don't have to memorize that 1/2 is zero.  You just have to learn
the general rule here, that division of two integers produces an integer.

Whether or not you like this feature, presenting it as you have is
incorrect and unfair.

-Justin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martijn Faassen  
View profile  
 More options Jul 22 2001, 5:14 pm
Newsgroups: comp.lang.python
From: m.faas...@vet.uu.nl (Martijn Faassen)
Date: 22 Jul 2001 21:14:36 GMT
Local: Sun, Jul 22 2001 5:14 pm
Subject: Re: PEP0238 lament

[snip Tim's reasons]

The audience was entirely self-selected; they were people with an interest
in numeric models. Did Guido ask for a show of hands in the big session
afterwards? I don't recall; I kind of suspect the outcome would've been
different.

> The current integer division
> loses information silently and without a trace.  Combined with that Python
> is not a statically typed language, there's simply no telling what e.g.
> def velocity(distance, time):
>    return distance / time
> will compute by inspection.

There's no telling what:

def add_stuff(a, b):
   return a + b

will compute by inspection either, though. Are we complaining about that?
(yeah, I know the inverse operation is rather hard to define for
string addition :)

[snip]

Of course I claim no expertise in this matter whatsoever. :)
For working with pixels in GUIs and such, integer division can be a useful
thing, though.

Regards,

Martijn
--
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cliff Crawford  
View profile  
 More options Jul 22 2001, 5:47 pm
Newsgroups: comp.lang.python
From: cj...@nospam.cornell.edu (Cliff Crawford)
Date: Sun, 22 Jul 2001 21:41:14 GMT
Local: Sun, Jul 22 2001 5:41 pm
Subject: Re: PEP0238 lament
* Tim Peters <tim....@home.com> menulis:
|
| The meaning of integer division wasn't the
| focus, but naturally came up.  By show of hands, about 3/4ths of the
| participants agreed that 3/4 should not return 0, but rather *something*
| [snip]

In other words, nobody raised their hand, since 3/4 == 0.  Well, that
settles it, then -- nobody wants this change <0.75 wink>.

--
Cliff Crawford            http://www.sowrong.org/
A sign should be posted over every campus toilet:
"This flush comes to you by courtesy of capitalism."
                                 -- Camille Paglia


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Moshe Zadka  
View profile  
 More options Jul 22 2001, 6:01 pm
Newsgroups: comp.lang.python
From: Moshe Zadka <mos...@zadka.site.co.il>
Date: Mon, 23 Jul 2001 00:00:53 +0300
Local: Sun, Jul 22 2001 5:00 pm
Subject: Re: PEP0238 lament
On Sun, 22 Jul 2001 13:24:22 -0700, Erik Max Francis <m...@alcyone.com> wrote:

> I agree.  It's turning an otherwise fairly strongly (but dynamically)
> typed language on its head.  If I want type-changing operations, I'll do
> them explicitly.

Be sure to tell math.cos that...it has been "silently" turning integers
into floats for years.

>     Esperanto reference / http://mirror/alcyone/max/lang/esperanto/

Err.....problem with the URL? I don't think there's a host called "mirror".
A pity, sounded interesting.
--
gpg --keyserver keyserver.pgp.com --recv-keys 46D01BD6 54C4E1FE
Secure (inaccessible): 4BD1 7705 EEC0 260A 7F21  4817 C7FC A636 46D0 1BD6
Insecure (accessible): C5A5 A8FA CA39 AB03 10B8  F116 1713 1BCF 54C4 E1FE

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Peters  
View profile  
 More options Jul 22 2001, 6:01 pm
Newsgroups: comp.lang.python
From: "Tim Peters" <tim....@home.com>
Date: Sun, 22 Jul 2001 17:05:18 -0400
Local: Sun, Jul 22 2001 5:05 pm
Subject: RE: PEP0238 lament
[David Eppstein]

> Well then, float is a very bad choice for what to return, or then how
> do we explain when 3/4 * 4 = 3 (exactly) but 3/10 * 10 != 10? [3
> was intended here]

Using decimal floats, 3/10*10 does equal 3, but a generation raised on
BCD-ish hand calculators wouldn't even blink an eye if 1/3*3 returned
0.999999999999.

> I would be a lot happier with integer / integer = rational (as in
> Mathematica's programming lang),

That view has its fans too; see PEPs 239 and 240; also mounds of prior
discussion on the python-numerics list:

    http://sourceforge.net/mail/?group_id=5470

You're probably new enough to this to have missed that Guido had lots of
experience with rationals in the ABC language and didn't like it there.
Speed and memory consumption were unpredictable for non-experts, and could
vary wildly (factors of 1000s) for a fixed algorithm, depending on the
inputs.  Rationals aren't a cure-all, and the instant you throw a sqrt or
transcendental into the mix you're back to some form of fp anyway.

> but float is just ugly.  It is turning exact values (integers) into
> approximate ones (float) when I didn't tell it to.

If the language defines "/" as returning a float, then you told it to.  You
*almost* may as well complain that math.sqrt(2) turns an exact value into an
approximate one; but, e.g., when I use Macsyma, it doesn't lose information
there either.  Python isn't going to do symbolic computation by default, so
the question isn't whether to compromise, but where.

> It's almost as bad as if integer subtraction always truncated to 16
> bit values -- a lot of the time that would give sort of reasonable
> answers but it's a gratuitous approximation where you didn't expect
> one.

You don't expect an approximation in that context because Python promises
not to make one in that context.  If you expect things a language doesn't
promise, that's not really the language's fault <wink>.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Peters  
View profile  
 More options Jul 22 2001, 6:01 pm
Newsgroups: comp.lang.python
From: "Tim Peters" <tim....@home.com>
Date: Sun, 22 Jul 2001 17:45:02 -0400
Local: Sun, Jul 22 2001 5:45 pm
Subject: RE: PEP0238 lament
[James Logajan]

> This has probably already been brought up, but perhaps the problem lies
> not with the "/" operator, but one step earlier in distinguishing the
> meaning of:

> x = 3
> and
> x = 3.

> That is subtle difference that can cause quite different results later
> on.

Why is that?  It's because unlike any other builtin arithmetic operation,
"/" today can cause *catastrophic* loss of information silently, and in
ordinary cases.  If code sticks to + - * and **, it usually doesn't matter
much in the end whether someone says

    x = 3
or
    x = 3.

at the start.  But toss in one "/", and radically different results are
common.

> Or, one may try to teach that when ALL arguments of an operator are in
> one "set", such as the set of integers, then one must expect a result
> that is an element from THAT set, not another set, such as the set of
> real numbers or from the set of complex numbers.  Set theory seems to
> be taught fairly early on in math, I think.

I think you're missing that the proponents are arguing on pragmatic grounds:
this has mostly to do with that x/y surprises people in real life.  It's not
that there aren't clear rules, or that the rules can't be taught, or that
people are too stupid to understand the rules.  Guido hears all the
complaints, and he's become convinced that this is a genuine and serious
flaw in the language:  the current rules are *unusable* for too many people
too often.  If you're not one of them, congratulations <wink>.  I'm not
either -- I never get burned by this.  But I see plenty of people who are,
and they're neither stupid nor careless; it's a common blind spot, so it
doesn't really matter that it's not one I (or you) suffer.

> ...
> I prefer a handful of general rules, and operators that obey them.

Of course, but computer numerics is a massive exercise in picking the
general rules you want to preserve at the expense of others, and trading all
that off against pragmatics too.  Not losing information silently is also a
Very Good General Rule, and even 745 binary fp arithmetic is better at
meeting that one than current "/".

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bengt Richter  
View profile  
 More options Jul 22 2001, 6:03 pm
Newsgroups: comp.lang.python
From: b...@accessone.com (Bengt Richter)
Date: Sun, 22 Jul 2001 22:03:30 GMT
Local: Sun, Jul 22 2001 6:03 pm
Subject: Re: PEP0238 lament

On Sun, 22 Jul 2001 14:22:21 -0400, "Tim Peters" <tim....@home.com> wrote:
>[Arthur_Sie...@rsmi.com]
>> ...
>> If I was told that experinced programmers might
>> appreciate this change for any possible reason -
>> I'd be quiet as a mouse.

I'd call myself experienced, though not yet with Python (though
I fancy my other experience gives me a leg up on most Python newbies).

I am generally so adaptable it's almost a problem, so I'll
have no big problem with '//' after I accept that this is Rome,
and I should do as the Romans do. It's certainly not going
to put me off Python ;-)

>Not all experienced programmers agree.  At the last Python Conference, I
>moderated a 40-some person group discussion on conceivable changes to
>Python's numeric model, not advocating but keeping the participants from
>killing each other <wink>.  The meaning of integer division wasn't the
>focus, but naturally came up.  By show of hands, about 3/4ths of the
>participants agreed that 3/4 should not return 0, but rather *something* x
>such that x*4 had a better chance of being confused with 3 than with 0.
>There was no consensus on exactly what 3/4 should return -- rational or HW
>float or decimal float were the most popular alternatives.

>It shouldn't be so hard to understand why.  The current integer division
>loses information silently and without a trace.  Combined with that Python

The thing is, current floating point operations also (sometimes, not always,
just as with integer ops) lose "information silently and without a trace."
Just less noticeably, for the most part, if you sanitize output.

Which leads me to wondering if exactness would be a more approachable
concept for CP4E than details of numeric representation alternatives.

For many 'float' is about as relevant to their desired computing experience
as 'hypoid' is to their commuting experience. Why not keep both hidden under
the hood (without welding it shut, of course) ?

>is not a statically typed language, there's simply no telling what e.g.

>def velocity(distance, time):
>    return distance / time

>will compute by inspection.  This isn't about esoteric user overloading of
>"/", it's about ordinary arithmetic on builtin numeric types, and many
>experienced Python programmers have testified over the years to being burned
>in practice by stuff exactly that simple.

I believe you. BTW, is there an efficient type assertion that doesn't go away with
optimization, that one could use to refuse wrong-type arguments?

>I expect that either way is easy enough to *teach*, but I don't accept ease
>of teaching as a primary goal:  I'm much keener on semantics that, once

Glad to hear that. <rant>Worst IMHO is when teachers teach what is actually wrong
to children or the otherwise innocently ignorant, with the rationale that
the real truth is too complicated, and even letting on that there is a real
truth will just be confusing. That not letting on part is the real evil.
Of course, many teachers are themselves the product of this methodology,
and pass it on unawares.</rant>

I wonder what K-12 teachers will say about Python float ;-/
Maybe there should be guidelines for teaching what is not understood,
so that bright kids don't get cynical too fast.

>*learned*, are hard to forget or to stumble over.  Even if such semantics
>are 100x harder to teach at first, fine by me:  you spend the rest of your
>life living with the consequences.  I wish the definition of continuity were
>easier to teach too, but that doesn't mean I'll settle for an easier
>definition that doesn't actually work <wink>.

You teach that? How many are you, anyway? ;-)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Grant Edwards  
View profile  
 More options Jul 22 2001, 6:28 pm
Newsgroups: comp.lang.python
From: gra...@visi.com (Grant Edwards)
Date: Sun, 22 Jul 2001 22:28:18 GMT
Local: Sun, Jul 22 2001 6:28 pm
Subject: Re: PEP0238 lament

On Sun, 22 Jul 2001 17:40:10 GMT, Rainy <s...@optonline.net> wrote:
>First of all, it's really ugly. It's the ugliest thing in python for a newbie,
>imho. Yes, 1/2 is 0. You have to type 1.0/2 to get 0.5. No, there is no good
>reason for that, just memorize it. Ugh.

There _is_ a good reason.  1 and 2 are integers.  How many 2s
can you fit into a 1?

None.

Zero.

--
Grant Edwards                   grante             Yow!  Can you MAIL a BEAN
                                  at               CAKE?
                               visi.com            


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Grant Edwards  
View profile  
 More options Jul 22 2001, 6:31 pm
Newsgroups: comp.lang.python
From: gra...@visi.com (Grant Edwards)
Date: Sun, 22 Jul 2001 22:31:34 GMT
Local: Sun, Jul 22 2001 6:31 pm
Subject: Re: PEP0238 lament

On Sun, 22 Jul 2001 14:22:21 -0400, Tim Peters <tim....@home.com> wrote:
>It shouldn't be so hard to understand why.  The current integer division
>loses information silently and without a trace.

No, it doesn't.  Integer division is integer division.  The
correct answer for the value of 3/4 is 0.  If you wanted the
remainder, you should ask for it.  If you want to divide
floating point numbers, you should _use_ floating point numbers.

Perhaps my mind was warped by using nothing but integer
arithmatic in my software for many years because floating point
was simply too slow and too expensive.

--
Grant Edwards                   grante             Yow!  Are we THERE yet? My
                                  at               MIND is a SUBMARINE!!
                               visi.com            


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Peters  
View profile  
 More options Jul 22 2001, 7:01 pm
Newsgroups: comp.lang.python
From: "Tim Peters" <tim....@home.com>
Date: Sun, 22 Jul 2001 18:02:31 -0400
Local: Sun, Jul 22 2001 6:02 pm
Subject: RE: PEP0238 lament
[Martijn Faassen]

> ...
> The audience was entirely self-selected;

Unlike, say, the participants in this discussion?  Hmm.  You set a rather
high standard here, Martijn <wink>.

? they were people with an interest in numeric models.

Or uninterested in Stackless (its "competition" in that time slot).  I
suppose the next time we want advice about Unicode, we should just ask
Americans.

> Did Guido ask for a show of hands in the big session afterwards?

No, not on this issue.

> I don't recall; I kind of suspect the outcome would've been different.

I actually think 1/2==0 bothers "the general" population more than those
with a keen interest in numerics.  Indeed, nobody with a keen interest in
numerics has bugged Guido about this except Moshe, that I know of; the most
visible repeated pressures have come from educators using Python as a means
to some other end.

>> The current integer division loses information silently and without a
>> trace combined with that Python is not a statically typed language,
>> there's simply no telling what e.g.

>>  def velocity(distance, time):
>>      return distance / time

>> will compute by inspection.
> There's no telling what:

> def add_stuff(a, b):
>    return a + b

> will compute by inspection either, though.

You chopped all my following text, saying that the velocity() example wasn't
about user-defined overloadings but about ordinary arithmetic on the builtin
numeric types.  A user trying e.g. velocity(3, 2) is simply going to be
surprised -- as countless newbies have testified on c.l.py over the years.

> ...
> For working with pixels in GUIs and such, integer division can be a
> useful thing, though.

It can be useful for many things; that's not at issue, and nobody has ever
proposed taking away the ability to get an integer result; the issue is how
to spell that.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Eppstein  
View profile  
 More options Jul 22 2001, 7:30 pm
Newsgroups: comp.lang.python
From: David Eppstein <eppst...@ics.uci.edu>
Date: Sun, 22 Jul 2001 16:27:32 -0700
Local: Sun, Jul 22 2001 7:27 pm
Subject: Re: PEP0238 lament
In article <mailman.995839419.19134.python-l...@python.org>,
 "Tim Peters" <tim....@home.com> wrote:

> A user trying e.g. velocity(3, 2) is simply going to be
> surprised -- as countless newbies have testified on c.l.py over the years.

My intuition is that the users who will be surprised that 1/2 = 0 are the
same ones who would be bitten by roundoff-error bugs if 1/2 = 0.5.
Result: buggier code since the errors are less obvious.

If you have a routine "velocity" in which it doesn't make sense to do
integer truncation, and it doesn't coerce its args to float by adding 0.0,
that's also a bug.
--
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppst...@ics.uci.edu http://www.ics.uci.edu/~eppstein/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Logajan  
View profile  
 More options Jul 22 2001, 7:37 pm
Newsgroups: comp.lang.python
From: James Logajan <Jam...@Lugoj.Com>
Date: Sun, 22 Jul 2001 16:37:00 -0700
Subject: Re: PEP0238 lament

Tim Peters wrote:
> Guido hears all the
> complaints, and he's become convinced that this is a genuine and serious
> flaw in the language:  the current rules are *unusable* for too many people
> too often.  If you're not one of them, congratulations <wink>.  I'm not
> either -- I never get burned by this.  But I see plenty of people who are,
> and they're neither stupid nor careless; it's a common blind spot, so it
> doesn't really matter that it's not one I (or you) suffer.

Well, having learned one set of expectations, I can say that I WILL suffer
some pain if this is changed. And it isn't a case of an expectation carried
over from another language!

Speaking of patterns, it unfortunately appears that Guido has a strong
tendency to take the existing user base for granted, since he continues to
keep the door open to code-breaking changes. There is only so much insult
("well, what you were doing was bad style anyway," or "you shouldn't have
written code that depends on integer division(!)") and injury (the more
Python you've written, the more likely something you wrote wont work with
the latest version and will need to spend hours reviewing,
just-in-case-anyway) before one decides that it just isn't worth the pain.

I do not want to continue to write more Python and expose myself to further
risk of having it either become dependent on an un-maintained and minority
release (e.g. "sorry, you should have upgraded to 3.1 years ago; who writes
stuff on 2.1 these days anyway?") or having a growing body of code to
constantly shepherd along to insure it runs on the next release.

That is the pragmatics from my point of view. And it doesn't give a damn
what real or perceived "flaw" in the language is being addressed.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 297   Newer >
« Back to Discussions « Newer topic     Older topic »