A use for integer quotients
Paul Sidorsky
paulsid at home.com
Tue Jul 24 02:54:26 EDT 2001
Stephen Horne wrote:
> I've been here already - mathematicians use the same set of operators
> whatever set of values. They exact representations aren't available to
> simple ASCII text files, so we use a single alternate representation.
> The point is that we should the same symbol for the same meaning,
> exactly the same as mathemeticians. When a mathematician asks 'I can't
> find a divide symbol, how do I do that?' the answer should be simple -
> it should not depend on which set of values he happens to be working
> in at the time.
> The fact that we need to choose an alternative symbol should not be
> seen as a chance to break with principles that mathematicians have
> applied successfuly since well before Christs time.
While on the subject of choosing symbols, I think the thing that really
bugs me most about this is that * and / are opposites (I won't say
"inverses" just in case somebody gets me on a mathematical
technicality), so shouldn't ** and // be opposites? I'll bet there will
be at least a few newcomers (that is mainly who the change is being made
for, right?) who will be casually browsing a Python operator list (e.g.
section 2.5 of the reference manual), see both ** and // on there, learn
what ** does, and assume // does the opposite. Or vice-versa. (This is
regardless of whatever kind of division // will do.)
Here's one example - it's easy think of many more:
x = (2**4)//2
Here x == 8, but isn't it awfully tempting at first glance to think x ==
4?! (Take the parentheses out and it's worse.)
I know the subject of which symbol should be used was beaten to death a
long time ago, and I don't want to revive that debate again so I'm not
expecting anybody to reply. I just wanted to get this off my chest
since it's been irking me all day and I wasn't around for the original
debate.
--
======================================================================
Paul Sidorsky Calgary, Canada
paulsid at home.com http://members.home.net/paulsid/
More information about the Python-list
mailing list