Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 2011-12-16, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Eelco wrote: the actual english usage of the phrase, which omits the negation completely :). (I could care less) No, that's the American usage. That's the _ignorant_ American usage. Americans with a clue use the couldn't version. I won't comment on the relative sizes of the two groups. The English usage is I couldn't care less, which has the advantage of actually making sense. Indeed. -- Grant Edwards grant.b.edwardsYow! HUGH BEAUMONT died at in 1982!! gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 16, 3:58 am, MRAB pyt...@mrabarnett.plus.com wrote: On 16/12/2011 02:14, alex23 wrote: Eelcohoogendoorn.ee...@gmail.com wrote: To tie it back in with python language design; all the more reason not to opt for pseudo-backwards compatibility. If python wants a remainder function, call it 'remainder'. Not 'rem', not 'mod', and certainly not '%'. Python has def, del, int, str, len, and so on. rem or mod (Ada has both, I believe) would be in keeping with the language. def and del are keywords, and thus in another league. Having shorthand notation for types is somewhat defensible, though I believe I would prefer a more verbose form there too; how often to you encounter these in python anyway? len is a bit of an eeysore to me too; I understand having it as a builtin is a matter of optimization or something, but I do wish we would be given the option of just saying list.length Good luck with the PEP. Its the more pythonic way; a self-describing name, rather than poorly defined or poorly understood cryptology. Although practicality beats purity. I'm still utterly agog that anyone finds the operator % confusing. In financial circles it could be an operator for calculating percentages, eg. 5 % x would be 5 percent of x. It's an oddity, but an established one. :-) Well yes, thats the only argument ive heard so far that resonated with me. These syntax details are not a very big deal, and backwards compatibility with yourself is quite a big deal. Its nice to keep 'what ought to have been done' and 'what ought we to do' seperate in such discussions. Im not sure we ought to change these syntax details (I mean relating to mod and such), but I am quite sure of what I would have done if I could go back in time. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 16, 6:30 am, alex23 wuwe...@gmail.com wrote: On Dec 16, 3:01 pm, Chris Angelico ros...@gmail.com wrote: And I would be most sorry to see % renamed to mod in Python. Hello, %s! My favourite number is %d. mod (Fred,42) # This just looks wrong. Finally we can give this operator a more fitting name - I propose 'inject' - and put an end to this insane desire to leverage off pre- existing knowledge of other languages. Furthermore, I suggest that no two languages should ever have identical semantics, just to avoid potential confusion. New concepts for all! Dont get me started on that one. Its that I never work with strings... 'leverage of pre-existing knowledge'... I would hardly call the particular names of functions the knowledge about a language. The only argument that bears any weight with me is backwards compatibility with itself. Pseudo-backwards compatibility with other languages, I couldnt not care less for. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 16, 3:25 pm, Eelco hoogendoorn.ee...@gmail.com wrote: Pseudo-backwards compatibility with other languages, I couldnt not care less for. Double negations n Goedelian situations have interesting implications (tho here its triple) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 16 dec, 18:38, rusi rustompm...@gmail.com wrote: On Dec 16, 3:25 pm, Eelco hoogendoorn.ee...@gmail.com wrote: Pseudo-backwards compatibility with other languages, I couldnt not care less for. Double negations n Goedelian situations have interesting implications (tho here its triple) Heh. Well at least my extra (unintended) negation is semantically consistent with the actual english usage of the phrase, which omits the negation completely :). (I could care less) But ill stick with trying to change one language at a time :). -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Eelco wrote: the actual english usage of the phrase, which omits the negation completely :). (I could care less) No, that's the American usage. The English usage is I couldn't care less, which has the advantage of actually making sense. -- Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 17, 12:49 am, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Eelco wrote: the actual english usage of the phrase, which omits the negation completely :). (I could care less) No, that's the American usage. The English usage is I couldn't care less, which has the advantage of actually making sense. -- Greg Oh thanks for clearing that up, never noticed a division along these lines. And yes, I agree; 'I couldnt care less' makes much more sense. 'I could care less' can only make sense if you interpret it sarcastically, as if omitting an 'oh wait, I cant', but that does not seem congruent with how its typically pronounced. Just another case of suboptimal language design; but where can you submit EEP's? -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
In article 2420abd7-7d91-4bc9-bb3b-d8ec1680e...@u32g2000yqe.googlegroups.com, Eelco hoogendoorn.ee...@gmail.com wrote: And yes, I agree; 'I couldnt care less' makes much more sense. 'I could care less' can only make sense if you interpret it sarcastically, as if omitting an 'oh wait, I cant', but that does not seem congruent with how its typically pronounced. I care so little about the subject that I am unwilling to spend one of my precious apostrophes to properly express the sentiment -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Fri, 16 Dec 2011 11:40:11 -0800, Eelco wrote: On 16 dec, 18:38, rusi rustompm...@gmail.com wrote: On Dec 16, 3:25 pm, Eelco hoogendoorn.ee...@gmail.com wrote: Pseudo-backwards compatibility with other languages, I couldnt not care less for. Double negations n Goedelian situations have interesting implications (tho here its triple) Heh. Well at least my extra (unintended) negation is semantically consistent with the actual english usage of the phrase, which omits the negation completely :). (I could care less) Oh please. I could care less is not English. That's American. Here in Australia, we follow the English practice of saying that we couldn't care less. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Fri, Dec 16, 2011 at 7:54 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Fri, 16 Dec 2011 11:40:11 -0800, Eelco wrote: On 16 dec, 18:38, rusi rustompm...@gmail.com wrote: On Dec 16, 3:25 pm, Eelco hoogendoorn.ee...@gmail.com wrote: Pseudo-backwards compatibility with other languages, I couldnt not care less for. Double negations n Goedelian situations have interesting implications (tho here its triple) Heh. Well at least my extra (unintended) negation is semantically consistent with the actual english usage of the phrase, which omits the negation completely :). (I could care less) Oh please. I could care less is not English. That's American. Here in Australia, we follow the English practice of saying that we couldn't care less. Well the phrase is still somewhat controversial in the US. I never heard it until age 19 (in 1966) and have always been somewhat disdainful of those using it. But it appears to be hopeless. http://articles.boston.com/2010-10-24/lifestyle/29303907_1_care-peeves-decades -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 15, 4:43 am, rusi rustompm...@gmail.com wrote: On Dec 14, 10:15 pm, Eelco hoogendoorn.ee...@gmail.com wrote: 'Kindof' off-topic, but what the hell :). deja-vu We keep having these debates -- so I wonder how off-topic it is... And so do famous CSists:http://research.microsoft.com/en-us/um/people/gurevich/opera/123.pdf /deja-vu Well, you are right, there are some deep links here. My view of what is wrong with mainstream mathematics is its strange interpretation of the semantics of classical logic. (And I dont think any other schools get it quite right either; I think finitists may avoid the mistakes of others, but are rightfully accussed of being needlessly restrictive, for instance) This is best illustrated by means of the principle of explosion. It rests on assuming a contradiction, and then assigning rather peculiar semantics to them. What is typically left unstated are the semantics of symbol lookup, but apparently it is implicitly understood one can pick whatever value upon encountering a contradicting symbol. There is no well defined rule for the lookup of a twice-defined symbol. Of course the sane thing to do, to a mind grown up around computer languages, upon encountering a twice defined symbol, is not to continue to generate deductions from both branches, but to throw an exception and interrupt the specific line of reasoning that depends on this contradicting symbol right then and there. Conceptually, we can see something is wrong with these undefined semantics right away. A logical system that allows you to draw conclusions as to where the pope shits from assertions about natural numbers could not more obviously be broken. If you dont have this broken way of dealing with contradictions, one does not have to do one of many silly and arbitrary things to make infinity work, such as making a choice between one-to-one correspondence and subset-relations for determining the cardinality of a set; one can simply admit the concept of infinity, while useful, is not consistent, keep the contradiction well handled instead of having it explode in your face (or explode into the field of transfinite analysis; a consequece of 'dealing' with these issues by rejecting the intuitively obviously true relation between subset relations and cardinality), and continue reasoning with the branches of your argument that you are interested in. In other words, what logic needs is a better exception-handling system, which completes the circle with programming languages quite nicely. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 12/14/11 12:32 PM, Steven D'Aprano wrote: On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote: I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask what the problem is. Maybe next time. So this was *one* person making that claim? I understand that, in general, mathematicians don't have much need for a remainder function in the same way programmers do -- modulo arithmetic is far more important. But there's a world of difference between saying In mathematics, extracting the remainder is not important enough to be given a special symbol and treated as an operator and saying remainder is not a binary operator. The first is reasonable; the second is not. The professional mathematicians that I know personally don't say that remainder is not a binary operator. They *do* say that modulo is not an operator in mathematics just because they have reserved that word and the corresponding notation to define the congruence relations. So for example, the following two statements are equivalent: 42 = 2 mod 5 2 = 42 mod 5 The mod 5 notation modifies the entire equation (or perhaps the = sign if you like to think about it like that), not the term it is immediately next to. Python's % operator is a binary operator that binds to a particular term, not the whole equation. The following two are not equivalent statements: 42 == 2 % 5 2 == 42 % 5 It's mostly kvetching on their part that programming language designers misunderstood the notation and applied the name to something that is confusingly almost, but not quite, the same thing. They aren't saying that you couldn't *define* such an operator; they would just prefer that we didn't abuse the name. But really, it's their fault for using notation that looks like an operator. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Thu, Dec 15, 2011 at 9:47 PM, Robert Kern robert.k...@gmail.com wrote: 42 = 2 mod 5 2 = 42 mod 5 It might make more sense to programmers if you think of it as written: 42 = 2, mod 5 2 = 42, mod 5 ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 15, 2:44 pm, Eelco hoogendoorn.ee...@gmail.com wrote: In other words, what logic needs is a better exception-handling system, which completes the circle with programming languages quite nicely. :) Cute... but dangerously recursive (if taken literally) Remember that logic is the foundation of programming language semantics. And your idea (suggests) that programming language semantics be made (part of) the foundation of logic. Of course I assume you are not being very literal. Still the dangers of unnoticed circularity are often... well unnoticed :-) eg. McCarthy gave the semantics of lisp in lisp -- a lisp interpreter in lisp is about a page of code. It probably was a decade before someone realized that the same semantics would 'work' for lazy or applicative (eager) order evaluation. This then begs the question what exactly it means for that semantics to 'work'... -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 15, 3:58 pm, Chris Angelico ros...@gmail.com wrote: On Thu, Dec 15, 2011 at 9:47 PM, Robert Kern robert.k...@gmail.com wrote: 42 = 2 mod 5 2 = 42 mod 5 It might make more sense to programmers if you think of it as written: 42 = 2, mod 5 2 = 42, mod 5 ChrisA For the record I should say that the guy who taught me abstract algebra, said about as much: He said that the notation a == b mod n should be written as a ==n b (read the == as 3 horizontal lines and the n as a subscript) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 15, 11:47 am, Robert Kern robert.k...@gmail.com wrote: On 12/14/11 12:32 PM, Steven D'Aprano wrote: On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote: I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask what the problem is. Maybe next time. So this was *one* person making that claim? I understand that, in general, mathematicians don't have much need for a remainder function in the same way programmers do -- modulo arithmetic is far more important. But there's a world of difference between saying In mathematics, extracting the remainder is not important enough to be given a special symbol and treated as an operator and saying remainder is not a binary operator. The first is reasonable; the second is not. The professional mathematicians that I know personally don't say that remainder is not a binary operator. They *do* say that modulo is not an operator in mathematics just because they have reserved that word and the corresponding notation to define the congruence relations. So for example, the following two statements are equivalent: 42 = 2 mod 5 2 = 42 mod 5 The mod 5 notation modifies the entire equation (or perhaps the = sign if you like to think about it like that), not the term it is immediately next to. Python's % operator is a binary operator that binds to a particular term, not the whole equation. The following two are not equivalent statements: 42 == 2 % 5 2 == 42 % 5 It's mostly kvetching on their part that programming language designers misunderstood the notation and applied the name to something that is confusingly almost, but not quite, the same thing. They aren't saying that you couldn't *define* such an operator; they would just prefer that we didn't abuse the name. But really, it's their fault for using notation that looks like an operator. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco Thanks Robert, I think you cut right through the confusion there. To tie it back in with python language design; all the more reason not to opt for pseudo-backwards compatibility. If python wants a remainder function, call it 'remainder'. Not 'rem', not 'mod', and certainly not '%'. Its the more pythonic way; a self-describing name, rather than poorly defined or poorly understood cryptology. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 15, 11:56 am, rusi rustompm...@gmail.com wrote: On Dec 15, 2:44 pm, Eelco hoogendoorn.ee...@gmail.com wrote: In other words, what logic needs is a better exception-handling system, which completes the circle with programming languages quite nicely. :) Cute... but dangerously recursive (if taken literally) Remember that logic is the foundation of programming language semantics. And your idea (suggests) that programming language semantics be made (part of) the foundation of logic. Of course I assume you are not being very literal. Still the dangers of unnoticed circularity are often... well unnoticed :-) Well, logic as a language has semantics, one way or the other. This circularity is a general theme in epistemology, and one that fits well with the view of deduction-induction as a closed loop cycle. Knowledge does not flow from axioms to theorems; axioms without an encompassing context are meaningless symbols. Its a body of knowledge as a whole that should be put to the test; the language and the things we express in it are inseperable. (the not-quite-famous-enough Quine in a nutshell) The thing is that our semantics of logic are quite primitive; cooked up in a time where people spent far less time thinking about these things, and having a far narrower base of experience to draw ideas from. They didnt have the luxury of already having grown up studying a dozen formal languages before embarking on creating their own. It other words, the semantics of logic is a legacy piece of crap, but an insanely firmly entrenched one. I mean, there are many sensible ways of defining semantics of conflicting symbols, but you'll find on studying these things that the guys who (often implicitly) laid down these rules didnt even seemed to have consciously thought about them. Not because they were stupid; far from it, but for similar reasons as to why the x86 architecture wasnt concieved of the day after the invention of the transistor. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
rusi writes: On Dec 15, 3:58 pm, Chris Angelico wrote: On Thu, Dec 15, 2011 at 9:47 PM, Robert Kern wrote: 42 = 2 mod 5 2 = 42 mod 5 It might make more sense to programmers if you think of it as written: 42 = 2, mod 5 2 = 42, mod 5 ChrisA For the record I should say that the guy who taught me abstract algebra, said about as much: He said that the notation a == b mod n should be written as a ==n b (read the == as 3 horizontal lines and the n as a subscript) I think the modulus is usually given in parentheses and preferably some whitespace: in text, a == b (mod n), using == for the triple -, and in a display: a == b(mod n). I think even a == b == c (mod n), without repeating the modulus every time. (A subscript sounds good if the modulus is simple. Perhaps it often is.) That way it does not even look like a binary operator. I think Graham, Knuth, and Patashnik play it nicely in their book Concrete Mathematics, where they have both mods: the congruence relation, and the binary operator. The book is targeted for computer scientists. As if mathematicians didn't use the exact same notations for different purposes, even in the same context, and often with no problems whatsoever as long as all parties happen to know what they are talking about. Often the uses are analogous, but at least the two main uses of (x,y) differ wildly. (So Knuth uses (x .. y) for the interval, but he is a programmer.) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 12/15/2011 6:04 AM, rusi wrote: On Dec 15, 3:58 pm, Chris Angelicoros...@gmail.com wrote: On Thu, Dec 15, 2011 at 9:47 PM, Robert Kernrobert.k...@gmail.com wrote: 42 = 2 mod 5 2 = 42 mod 5 It might make more sense to programmers if you think of it as written: 42 = 2, mod 5 2 = 42, mod 5 Better, using ascii text, would be 42 =mod5 2 where =mod is a parameterized equivalence relation that is coarser than = (which is =mod-infinity). divmod(a,inf) = 0,a. =mod1 is the most coarse relation in that it make every count equivalent. divmod(a,1) = a,1. For the record I should say that the guy who taught me abstract algebra, said about as much: He said that the notation a == b mod n should be written as a ==n b (read the == as 3 horizontal lines and the n as a subscript) The 3 horizontal line symbol is often used for equivalence relations other than =. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Eelco hoogendoorn.ee...@gmail.com wrote: To tie it back in with python language design; all the more reason not to opt for pseudo-backwards compatibility. If python wants a remainder function, call it 'remainder'. Not 'rem', not 'mod', and certainly not '%'. Good luck with the PEP. Its the more pythonic way; a self-describing name, rather than poorly defined or poorly understood cryptology. Although practicality beats purity. I'm still utterly agog that anyone finds the operator % confusing. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 16/12/2011 02:14, alex23 wrote: Eelcohoogendoorn.ee...@gmail.com wrote: To tie it back in with python language design; all the more reason not to opt for pseudo-backwards compatibility. If python wants a remainder function, call it 'remainder'. Not 'rem', not 'mod', and certainly not '%'. Python has def, del, int, str, len, and so on. rem or mod (Ada has both, I believe) would be in keeping with the language. Good luck with the PEP. Its the more pythonic way; a self-describing name, rather than poorly defined or poorly understood cryptology. Although practicality beats purity. I'm still utterly agog that anyone finds the operator % confusing. In financial circles it could be an operator for calculating percentages, eg. 5 % x would be 5 percent of x. It's an oddity, but an established one. :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Fri, Dec 16, 2011 at 1:58 PM, MRAB pyt...@mrabarnett.plus.com wrote: In financial circles it could be an operator for calculating percentages, eg. 5 % x would be 5 percent of x. It's an oddity, but an established one. :-) And I would be most sorry to see % renamed to mod in Python. Hello, %s! My favourite number is %d. mod (Fred,42) # This just looks wrong. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 16, 3:01 pm, Chris Angelico ros...@gmail.com wrote: And I would be most sorry to see % renamed to mod in Python. Hello, %s! My favourite number is %d. mod (Fred,42) # This just looks wrong. Finally we can give this operator a more fitting name - I propose 'inject' - and put an end to this insane desire to leverage off pre- existing knowledge of other languages. Furthermore, I suggest that no two languages should ever have identical semantics, just to avoid potential confusion. New concepts for all! -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 15, 2011 8:01 PM, MRAB pyt...@mrabarnett.plus.com wrote: Python has def, del, int, str, len, and so on. rem or mod (Ada has both, I believe) would be in keeping with the language. I think I would have to object to rem purely on the basis that it denotes comments in BASIC. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is whatever some dead guy said it was, and they dont know of any dead guy ever talking about a modulus operation, so therefore it 'does not exist'. You've studied the contemporary philosophy of mathematics huh? How about studying some actual mathematics before making such absurd pronouncements on the psychology of mathematicians? The philosophy was just a sidehobby to the study of actual mathematics; and you are right, studying their works is the best way to get to know them. Speaking from that vantage point, I can say with certainty that the vast majority of mathematicians do not have a coherent philosophy, and they adhere to some loosely defined form of platonism. Indeed that is absurd in a way. Even though you may trust these people to be perfectly functioning deduction machines, you really shouldnt expect them to give sensible answers to the question of which are sensible axioms to adopt. They dont have a reasoned answer to this, they will by and large defer to authority. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Steven D'Aprano writes: On Mon, 12 Dec 2011 09:29:11 -0800, Eelco wrote: [quoting Jussi Piitulainen jpiit...@ling.helsinki.fi] They recognize modular arithmetic but for some reason insist that there is no such _binary operation_. But as I said, I don't understand their concern. (Except the related concern about some programming languages, not Python, where the remainder does not behave well with respect to division.) I've never come across this, and frankly I find it implausible that *actual* mathematicians would say that. Likely you are misunderstanding a technical argument about remainder being a relation rather than a bijunction. The argument would go something like this: (For 'bijunction', read 'function'.) I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask what the problem is. Maybe next time. But you are right that I don't know how actual mathematicians these people are. I'm not a mathematician. I don't know where to draw the line. A Finnish actual mathematician stated a similar prejudice towards mod as a binary operator in a Finnish group. I asked him what is wrong with Knuth's definition (remainder after flooring division), and I think he conceded that it's not wrong. Number theorists just choose to work with congruence relations. I have no problem with that. He had experience with students who confused congruences modulo some modulus with a binary operation, and mixed up their notations because of that. That is a reason to be suspicious, but it is a confusion on the part of the students. Graham, Knuth, Patashnik contrast the two concepts explicitly, no confusion there. And I know that there are many ways to define division and remainder so that x div y + x rem y = x. Boute's paper cited in [1] advocates a different one and discusses others. [1] http://en.wikipedia.org/wiki/Modulo_operation But I think the argument there are several such functions, therefore, _in mathematics_, there is no such function is its own caricature. Remainder is not uniquely defined. For example, the division of -42 by -5 can be written as either: 9*-5 + 3 = -42 8*-5 + -2 = -42 so the remainder is either 3 or -2. Hence remainder is not a bijection (1:1 function). Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. (There is no way to make remainder a bijection. You mean it is not a function if it is looked at in a particular way.) [The square root was relevant but I snipped it.] Similarly, we can sensibly define the remainder or modulus operator to consistently return a non-negative remainder, or to do what Python does, which is to return a remainder with the same sign as the divisor: ... There may be practical or logical reasons for preferring one over the other, but either choice would make remainder a bijection. One might even define two separate functions/operators, one for each behaviour. Scheme is adopting flooring division, ceiling-ing division, rounding division, truncating division, centering division, and the Euclidean division advocated by Boute, and the corresponding remainders. There is no better way to bring home to a programmer the points that there are different ways to define these, and they come as div _and_ rem. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 14 dec, 09:56, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Steven D'Aprano writes: On Mon, 12 Dec 2011 09:29:11 -0800, Eelco wrote: [quoting Jussi Piitulainen jpiit...@ling.helsinki.fi] They recognize modular arithmetic but for some reason insist that there is no such _binary operation_. But as I said, I don't understand their concern. (Except the related concern about some programming languages, not Python, where the remainder does not behave well with respect to division.) I've never come across this, and frankly I find it implausible that *actual* mathematicians would say that. Likely you are misunderstanding a technical argument about remainder being a relation rather than a bijunction. The argument would go something like this: (For 'bijunction', read 'function'.) I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask what the problem is. Maybe next time. But you are right that I don't know how actual mathematicians these people are. I'm not a mathematician. I don't know where to draw the line. A Finnish actual mathematician stated a similar prejudice towards mod as a binary operator in a Finnish group. I asked him what is wrong with Knuth's definition (remainder after flooring division), and I think he conceded that it's not wrong. Number theorists just choose to work with congruence relations. I have no problem with that. He had experience with students who confused congruences modulo some modulus with a binary operation, and mixed up their notations because of that. That is a reason to be suspicious, but it is a confusion on the part of the students. Graham, Knuth, Patashnik contrast the two concepts explicitly, no confusion there. And I know that there are many ways to define division and remainder so that x div y + x rem y = x. Boute's paper cited in [1] advocates a different one and discusses others. [1] http://en.wikipedia.org/wiki/Modulo_operation But I think the argument there are several such functions, therefore, _in mathematics_, there is no such function is its own caricature. Indeed. Obtaining a well defined function is just a matter of picking a convention and sticking with it. Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont really allow for this though. One could have: d, r = a // b But it wouldnt work that well in composite expressions; selecting the right tuple index would be messy and a more verbose form would be preferred. However, performance-wise its also clearly the best solution, as one often needs both output arguments and computing them simultaniously is most efficient. At least numpy should have something like: d, r = np.integer_division(a, b) And something similar in the math module for scalars. Remainder is not uniquely defined. For example, the division of -42 by -5 can be written as either: 9*-5 + 3 = -42 8*-5 + -2 = -42 so the remainder is either 3 or -2. Hence remainder is not a bijection (1:1 function). Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. (There is no way to make remainder a bijection. You mean it is not a function if it is looked at in a particular way.) Surjection is the word you are looking for That is, if one buys the philosophy of modernists like bourbaki in believing there is much to be gained by such pedantry. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 14, 1:56 pm, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. - Haskell defines a quot-rem pair and a div-mod pair as follows: (from http://www.haskell.org/onlinereport/basic.html) (x `quot` y)*y + (x `rem` y) == x (x `div` y)*y + (x `mod` y) == x `quot` is integer division truncated toward zero, while the result of `div` is truncated toward negative infinity. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Wed, Dec 14, 2011 at 10:47 PM, rusi rustompm...@gmail.com wrote: `quot` is integer division truncated toward zero, while the result of `div` is truncated toward negative infinity. All these problems just because of negative numbers. They ought never to have been invented. At least nobody rounds toward positive infinity... oh wait, that's legal too. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is whatever some dead guy said it was, and they dont know of any dead guy ever talking about a modulus operation, so therefore it 'does not exist'. You've studied the contemporary philosophy of mathematics huh? How about studying some actual mathematics before making such absurd pronouncements on the psychology of mathematicians? The philosophy was just a sidehobby to the study of actual mathematics; and you are right, studying their works is the best way to get to know them. Speaking from that vantage point, I can say with certainty that the vast majority of mathematicians do not have a coherent philosophy, and they adhere to some loosely defined form of platonism. Indeed that is absurd in a way. Even though you may trust these people to be perfectly functioning deduction machines, you really shouldnt expect them to give sensible answers to the question of which are sensible axioms to adopt. They dont have a reasoned answer to this, they will by and large defer to authority. Please come down from your vantage point for a few moments and consider how insulting your remarks are to people who have devoted most of their intellectual energy to the study of mathematics. So you've studied a bit of mathematics and a bit of philosophy? Good start, keep working at it. You think that every mathematician should be preoccupied with what axioms to adopt, and why? Mathematics is a very large field of study and yes, some mathematicians are concerned with these issues (they are called logicians) but for most it isn't really about axioms. Mathematics is bigger than the axioms that we use to formalise it. Most mathematicians do not need to care about what precise axiomatisation underlies the mathematics that they practise because they are thinking on a much higher level. Just like we do not worry about what machine language instruction actually performs each step of the Python program we are writing. You say that mathematicians defer to authority, but do you really think that thousands of years of evolution and refinement in mathematics are to be discarded lightly? I think not. It's good to have original ideas, to pursue them and to believe in them, but it would be foolish to think that they are superior to knowledge which has been accumulated over so many generations. You claim that mathematicians have a poor understanding of philosophy. It may be so for many of them, but how is this a problem? I doesn't prevent them from having a deep understanding of their field of mathematics. Do philosophers have a good understanding of mathematics? Cheers, -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Eelco writes: On 14 dec, 09:56, Jussi Piitulainen wrote: But I think the argument there are several such functions, therefore, _in mathematics_, there is no such function is its own caricature. Indeed. Obtaining a well defined function is just a matter of picking a convention and sticking with it. Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont really allow for this though. One could have: d, r = a // b But it wouldnt work that well in composite expressions; selecting the right tuple index would be messy and a more verbose form would be preferred. However, performance-wise its also clearly the best solution, as one often needs both output arguments and computing them simultaniously is most efficient. The current Scheme draft does this. For each rounding method, it provides an operation that provides both the quotient and the remainder, an operation that provides the quotient, and an operation that provides the remainder. The both-values operation is more awkward to compose, as you rightly say. It's just a matter of naming them all. Python has a good default integer division as the pair of operators // and %. Python also supports the returning of several values from functions as tuples. It can be done. Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. (There is no way to make remainder a bijection. You mean it is not a function if it is looked at in a particular way.) Surjection is the word you are looking for Um, no, I mean function. The allegedly alleged problem is that there may be two (or more) different values for f(x,y), which makes f not a _function_ (and the notation f(x,y) maybe inappropriate). Surjectivity is as much beside the point as bijectivity, but I think we have surjectivity for rem: Z * Z - Z if we use a definition that produces both positive and negative remainders, or rem: Z * Z - N if we have non-negative remainders (and include 0 in N, which is another bone of contention). We may or may not want to exclude 0 as the modulus, or divisor if you like. It is at least a special case. It's injectivity that fails: 9 % 4 == 6 % 5 == 3 % 2, while Python quite sensibly has (9, 4) != (6, 5) != (3, 2). (How I love the chaining of the comparisons.) That is, if one buys the philosophy of modernists like bourbaki in believing there is much to be gained by such pedantry. I think something is gained. Not sure I would call it philosophy. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote: Steven D'Aprano writes: On Mon, 12 Dec 2011 09:29:11 -0800, Eelco wrote: [quoting Jussi Piitulainen jpiit...@ling.helsinki.fi] They recognize modular arithmetic but for some reason insist that there is no such _binary operation_. But as I said, I don't understand their concern. (Except the related concern about some programming languages, not Python, where the remainder does not behave well with respect to division.) I've never come across this, and frankly I find it implausible that *actual* mathematicians would say that. Likely you are misunderstanding a technical argument about remainder being a relation rather than a bijunction. The argument would go something like this: (For 'bijunction', read 'function'.) Oops, you're right of course. It's been about 20 years since I've needed to care about the precise difference between a bijection and a function, and I made a mistake. And then to add to my shame, I also misspelt bijection. I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask what the problem is. Maybe next time. So this was *one* person making that claim? I understand that, in general, mathematicians don't have much need for a remainder function in the same way programmers do -- modulo arithmetic is far more important. But there's a world of difference between saying In mathematics, extracting the remainder is not important enough to be given a special symbol and treated as an operator and saying remainder is not a binary operator. The first is reasonable; the second is not. But you are right that I don't know how actual mathematicians these people are. I'm not a mathematician. I don't know where to draw the line. A Finnish actual mathematician stated a similar prejudice towards mod as a binary operator in a Finnish group. I asked him what is wrong with Knuth's definition (remainder after flooring division), and I think he conceded that it's not wrong. Number theorists just choose to work with congruence relations. I have no problem with that. Agreed. [...] (There is no way to make remainder a bijection. You mean it is not a function if it is looked at in a particular way.) You're right, of course -- remainder cannot be 1:1. I don't know what I was thinking. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 14 dec, 12:55, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is whatever some dead guy said it was, and they dont know of any dead guy ever talking about a modulus operation, so therefore it 'does not exist'. You've studied the contemporary philosophy of mathematics huh? How about studying some actual mathematics before making such absurd pronouncements on the psychology of mathematicians? The philosophy was just a sidehobby to the study of actual mathematics; and you are right, studying their works is the best way to get to know them. Speaking from that vantage point, I can say with certainty that the vast majority of mathematicians do not have a coherent philosophy, and they adhere to some loosely defined form of platonism. Indeed that is absurd in a way. Even though you may trust these people to be perfectly functioning deduction machines, you really shouldnt expect them to give sensible answers to the question of which are sensible axioms to adopt. They dont have a reasoned answer to this, they will by and large defer to authority. Please come down from your vantage point for a few moments and consider how insulting your remarks are to people who have devoted most of their intellectual energy to the study of mathematics. So you've studied a bit of mathematics and a bit of philosophy? Good start, keep working at it. Thanks, I intend to. You think that every mathematician should be preoccupied with what axioms to adopt, and why? Of course I dont. If you wish to restrict your attention to the exploration of the consequences of axioms others throw at you, that is a perfectly fine specialization. Most mathematicians do exactly that, and thats fine. But that puts them in about as ill a position to judged what is, or shouldnt be defined, as the average plumber. Compounding the problem is not just that they do not wish to concern themselves with the inductive aspect of mathematics, they would like to pretend it does not exist at all. For instance, if you point out to them a 19th century mathematician used very different axioms than a 20th century one, (and point out they were both fine mathematicians that attained results universally celebrated), they will typically respond emotionally; get angry or at least annoyed. According to their pseudo-Platonist philosophy, mathematics should not have an inductive side, axioms are set in stone and not a human affair, and the way they answer the question as to where knowledge about the 'correct' mathematical axioms comes from is by an implicit or explicit appeal to authority. They dont explain how it is that they can see 'beyond the platonic cave' to find the 'real underlying truth', they quietly assume somebody else has figured it out in the past, and leave it at that. You say that mathematicians defer to authority, but do you really think that thousands of years of evolution and refinement in mathematics are to be discarded lightly? I think not. It's good to have original ideas, to pursue them and to believe in them, but it would be foolish to think that they are superior to knowledge which has been accumulated over so many generations. For what its worth; insofar as my views can be pidgeonholed, im with the classicists (pre-20th century), which indeed has a long history. Modernists in turn discard large swaths of that. Note that its largely an academic debate though; everybody agrees that 1+1=2. But there are some practical consequences; if I were the designated science-Tsar, all transfinite-analysist would be out on the street together with the homeopaths, for instance. You claim that mathematicians have a poor understanding of philosophy. It may be so for many of them, but how is this a problem? I doesn't prevent them from having a deep understanding of their field of mathematics. Do philosophers have a good understanding of mathematics? As a rule of thumb: absolutely not, no. I dont think I can think of any philosopher who turned his attention to mathematics that ever wrote anything interesting. All the interesting writers had their boots on mathematical ground; Quine, Brouwer, Weyl and the earlier renaissance men like Gauss and contemporaries. The fragmentation of disciplines is infact a major problem in my opinion though. Most physicists take their mathematics from the ivory- math tower, and the mathematicians shudder at the idea of listning back to see which of what they cooked up is actually anything but mental masturbation, in the meanwhile cranking out more gibberish about alephs. If any well-reasoned philosophy enters into
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont really allow for this though. One could have: d, r = a // b That would be: divmod(17, 5) (3, 2) But it wouldnt work that well in composite expressions; selecting the right tuple index would be messy and a more verbose form would be preferred. However, performance-wise its also clearly the best solution, as one often needs both output arguments and computing them simultaniously is most efficient. Premature optimization. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 14 dec, 13:22, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. (There is no way to make remainder a bijection. You mean it is not a function if it is looked at in a particular way.) Surjection is the word you are looking for Um, no, I mean function. The allegedly alleged problem is that there may be two (or more) different values for f(x,y), which makes f not a _function_ (and the notation f(x,y) maybe inappropriate). Surjectivity is as much beside the point as bijectivity, but I think we have surjectivity for rem: Z * Z - Z if we use a definition that produces both positive and negative remainders, or rem: Z * Z - N if we have non-negative remainders (and include 0 in N, which is another bone of contention). We may or may not want to exclude 0 as the modulus, or divisor if you like. It is at least a special case. It's injectivity that fails: 9 % 4 == 6 % 5 == 3 % 2, while Python quite sensibly has (9, 4) != (6, 5) != (3, 2). (How I love the chaining of the comparisons.) My reply was more to the statement you quoted than to yours; sorry for the confusion. Yes, we have surjectivity and not injectivity, thats all I was trying to say. That is, if one buys the philosophy of modernists like bourbaki in believing there is much to be gained by such pedantry. I think something is gained. Not sure I would call it philosophy. Agreed; its more the notion that one stands to gain much real knowledge by writing volumnius books about these matters that irks me, but I guess thats more a matter of taste than philosophy. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
rusi writes: On Dec 14, 1:56 pm, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. - Haskell defines a quot-rem pair and a div-mod pair as follows: (from http://www.haskell.org/onlinereport/basic.html) (x `quot` y)*y + (x `rem` y) == x (x `div` y)*y + (x `mod` y) == x `quot` is integer division truncated toward zero, while the result of `div` is truncated toward negative infinity. Exactly what I mean. (I gave an incorrect equation but meant this.) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Steven D'Aprano writes: On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote: I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask what the problem is. Maybe next time. So this was *one* person making that claim? I've seen it a few times from a few different posters, all on Usenet or whatever this thing is nowadays called. I think I was careful to say _some_ mathematicians, but not careful to check that any of them were actually mathematicians speaking as mathematicians. The context seems to be a cultural divide between maths and cs. Too much common ground yet very different interests? I understand that, in general, mathematicians don't have much need for a remainder function in the same way programmers do -- modulo arithmetic is far more important. But there's a world of difference between saying In mathematics, extracting the remainder is not important enough to be given a special symbol and treated as an operator and saying remainder is not a binary operator. The first is reasonable; the second is not. Yes. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 14, 1:38 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont really allow for this though. One could have: d, r = a // b That would be: divmod(17, 5) (3, 2) Cool; if only it were in the math module id be totally happy. But it wouldnt work that well in composite expressions; selecting the right tuple index would be messy and a more verbose form would be preferred. However, performance-wise its also clearly the best solution, as one often needs both output arguments and computing them simultaniously is most efficient. Premature optimization. We are talking language design here, not language use. Whether or not this is premature is a decision that should be left to the user, if at all possible, which in this case it very well is; just provide multiple functions to cover all use cases (only return divisor, only return remainder, or both) -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Thu, Dec 15, 2011 at 12:29 AM, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 1:38 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: That would be: divmod(17, 5) (3, 2) Cool; if only it were in the math module id be totally happy. That's easily solved. import math math.divmod=divmod del __builtins__.divmod :) ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Wed, Dec 14, 2011 at 6:29 AM, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 1:38 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont really allow for this though. One could have: d, r = a // b That would be: divmod(17, 5) (3, 2) Cool; if only it were in the math module id be totally happy. Probably it's not in math because it's not a thin wrapper around a C math library function, which is how the module was conceived. There are already some exceptions in the math module, but I think they are all newer than divmod. -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 14 December 2011 12:33, Eelco hoogendoorn.ee...@gmail.com wrote: On 14 dec, 12:55, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is whatever some dead guy said it was, and they dont know of any dead guy ever talking about a modulus operation, so therefore it 'does not exist'. You've studied the contemporary philosophy of mathematics huh? How about studying some actual mathematics before making such absurd pronouncements on the psychology of mathematicians? The philosophy was just a sidehobby to the study of actual mathematics; and you are right, studying their works is the best way to get to know them. Speaking from that vantage point, I can say with certainty that the vast majority of mathematicians do not have a coherent philosophy, and they adhere to some loosely defined form of platonism. Indeed that is absurd in a way. Even though you may trust these people to be perfectly functioning deduction machines, you really shouldnt expect them to give sensible answers to the question of which are sensible axioms to adopt. They dont have a reasoned answer to this, they will by and large defer to authority. Please come down from your vantage point for a few moments and consider how insulting your remarks are to people who have devoted most of their intellectual energy to the study of mathematics. So you've studied a bit of mathematics and a bit of philosophy? Good start, keep working at it. Thanks, I intend to. You think that every mathematician should be preoccupied with what axioms to adopt, and why? Of course I dont. If you wish to restrict your attention to the exploration of the consequences of axioms others throw at you, that is a perfectly fine specialization. Most mathematicians do exactly that, and thats fine. But that puts them in about as ill a position to judged what is, or shouldnt be defined, as the average plumber. You are completely mistaken. Whatever the axiomatisation of the mathematics that we do, we can still do the same mathematics. We don't even need an axiomatic basis to do mathematics. In fact, the formalisation of mathematics has always come after the mathematics were well established.Euclid, Dedekind, Peano, Zermelo, Frankael, didn't create axiomatic systems out of nothing. They axiomatised pre-existing theories. Axiomatising a theory is just one way of exploring it. Compounding the problem is not just that they do not wish to concern themselves with the inductive aspect of mathematics, they would like to pretend it does not exist at all. For instance, if you point out to them a 19th century mathematician used very different axioms than a 20th century one, (and point out they were both fine mathematicians that attained results universally celebrated), they will typically respond emotionally; get angry or at least annoyed. According to their pseudo-Platonist philosophy, mathematics should not have an inductive side, axioms are set in stone and not a human affair, and the way they answer the question as to where knowledge about the 'correct' mathematical axioms comes from is by an implicit or explicit appeal to authority. They dont explain how it is that they can see 'beyond the platonic cave' to find the 'real underlying truth', they quietly assume somebody else has figured it out in the past, and leave it at that. Again, you are completely mis-representing the situation. In my experience, most mathematicians (I'm not talking about undergraduate students here) do not see the axioms are the root of the mathematics that they do. Formal systems are just one way to explore mathematics. Of course they can in some cases be very useful and enlightening. As for inductive reasoning, I really can't understand your point. Of course mathematicians use inductive reasoning all the time. Where do you think the Riemann Hypothesis comes from? Or Fermat's last theorem? Do you think that mathematicians prove results before they even think about them? On the other hand, a result needs to be proved to be accepted by the mathematical community, and inductive reasoning is not valid in proofs. That's in the nature of mathematics. You say that mathematicians defer to authority, but do you really think that thousands of years of evolution and refinement in mathematics are to be discarded lightly? I think not. It's good to have original ideas, to pursue them and to believe in them, but it would be foolish to think that they are superior to knowledge which has been accumulated over so many generations. For what its worth; insofar as my views can be
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
'Kindof' off-topic, but what the hell :). On Dec 14, 5:13 pm, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 12:33, Eelco hoogendoorn.ee...@gmail.com wrote: On 14 dec, 12:55, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is whatever some dead guy said it was, and they dont know of any dead guy ever talking about a modulus operation, so therefore it 'does not exist'. You've studied the contemporary philosophy of mathematics huh? How about studying some actual mathematics before making such absurd pronouncements on the psychology of mathematicians? The philosophy was just a sidehobby to the study of actual mathematics; and you are right, studying their works is the best way to get to know them. Speaking from that vantage point, I can say with certainty that the vast majority of mathematicians do not have a coherent philosophy, and they adhere to some loosely defined form of platonism. Indeed that is absurd in a way. Even though you may trust these people to be perfectly functioning deduction machines, you really shouldnt expect them to give sensible answers to the question of which are sensible axioms to adopt. They dont have a reasoned answer to this, they will by and large defer to authority. Please come down from your vantage point for a few moments and consider how insulting your remarks are to people who have devoted most of their intellectual energy to the study of mathematics. So you've studied a bit of mathematics and a bit of philosophy? Good start, keep working at it. Thanks, I intend to. You think that every mathematician should be preoccupied with what axioms to adopt, and why? Of course I dont. If you wish to restrict your attention to the exploration of the consequences of axioms others throw at you, that is a perfectly fine specialization. Most mathematicians do exactly that, and thats fine. But that puts them in about as ill a position to judged what is, or shouldnt be defined, as the average plumber. You are completely mistaken. Whatever the axiomatisation of the mathematics that we do, we can still do the same mathematics. We don't even need an axiomatic basis to do mathematics. In fact, the formalisation of mathematics has always come after the mathematics were well established. Euclid, Dedekind, Peano, Zermelo, Frankael, didn't create axiomatic systems out of nothing. They axiomatised pre-existing theories. Axiomatising a theory is just one way of exploring it. Yes, axiomization is to some extent a side-show. We know what it is that we want mathematics to be, and we try to find the axioms that lead to those conclusions. Not qualitatively different from any other form of induction (of the epistemological rather than mathematical kind). Still, different axioms or meta-mathematics give subtly different results, not to mention are as different to work with as assembler and haskell. There are no alephs if you start from a constructive basis, for instance. Im not sure what 'Axiomatising a theory is just one way of exploring it' means. One does not axiomatize a single theory; that would be trivial (A is true because thats what I define A to be). One constructs a single set of axioms from which a nontrivial set of theorems follow. The way id put it, is that axiomazation is about being explicit in what it is that you assume, trying to minimalize that, and being systematic about what conclusions that forces you to embrace. Could you be more precise as to how I am 'completely mistaken'? I acknowledge that my views are outside the mainstream, so its no news to me many would think so, but it would be nice to know what im arguing against in this thread precisely. Compounding the problem is not just that they do not wish to concern themselves with the inductive aspect of mathematics, they would like to pretend it does not exist at all. For instance, if you point out to them a 19th century mathematician used very different axioms than a 20th century one, (and point out they were both fine mathematicians that attained results universally celebrated), they will typically respond emotionally; get angry or at least annoyed. According to their pseudo-Platonist philosophy, mathematics should not have an inductive side, axioms are set in stone and not a human affair, and the way they answer the question as to where knowledge about the 'correct' mathematical axioms comes from is by an implicit or explicit appeal to authority. They dont explain how it is that they can see 'beyond the platonic
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On 12/14/2011 5:09 AM, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; It actually is, as quotient and remainder are calculated together. The microprocessors I know of expose this (as does Python). 'a divmod b' puts the quotient in one register and the remainder in another. If you ask for just one of the two values, both are calculated and one is grabbed while the other is returned. which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont really allow for this though. One could have: d, r = a // b a,b = divmod(10,3) a,b (3, 1) With CPython, int.__divmod__ lightly wraps and exposes the processor operation. But it wouldnt work that well in composite expressions; selecting the right tuple index would be messy and a more verbose form would be preferred. That is why we have a == 10 // 3 True b == 10 % 3 True In both cases, I believe CPython calls int.__divmod__ (or the lower level equivalent) to calculate both values, and one is returned while the other is ignored. It it the same when one does long division by hand. However, performance-wise its also clearly the best solution, as one often needs both output arguments and computing them simultaniously is most efficient. As indicated above, there is really no choice but to calculate both at once. If one needs both a//b and a%b, one should explicitly call divmod once and save (name) both values, instead of calling it implicitly twice and tossing half the answer each time. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Dec 14, 10:15 pm, Eelco hoogendoorn.ee...@gmail.com wrote: 'Kindof' off-topic, but what the hell :). deja-vu We keep having these debates -- so I wonder how off-topic it is... And so do famous CSists: http://research.microsoft.com/en-us/um/people/gurevich/opera/123.pdf /deja-vu : : Again, you are completely mis-representing the situation. In my experience, most mathematicians (I'm not talking about undergraduate students here) do not see the axioms are the root of the mathematics that they do. Formal systems are just one way to explore mathematics. Of course they can in some cases be very useful and enlightening. Its your word versus mine I suppose. Some older discussions: http://groups.google.com/group/comp.lang.python/browse_thread/thread/46435c36f3a13621/896579b757126243?lnk=gstq=rusi+steven+platonism#896579b757126243 http://groups.google.com/group/comp.lang.python/browse_thread/thread/d36dcd2e2e175d1e/45dd596bc050ac2d?lnk=gstq=rusi+steven+platonism#45dd596bc050ac2d -- http://mail.python.org/mailman/listinfo/python-list
% is not an operator [was Re: Verbose and flexible args and kwargs syntax]
On Mon, 12 Dec 2011 09:29:11 -0800, Eelco wrote: [quoting Jussi Piitulainen jpiit...@ling.helsinki.fi] They recognize modular arithmetic but for some reason insist that there is no such _binary operation_. But as I said, I don't understand their concern. (Except the related concern about some programming languages, not Python, where the remainder does not behave well with respect to division.) I've never come across this, and frankly I find it implausible that *actual* mathematicians would say that. Likely you are misunderstanding a technical argument about remainder being a relation rather than a bijunction. The argument would go something like this: Remainder is not uniquely defined. For example, the division of -42 by -5 can be written as either: 9*-5 + 3 = -42 8*-5 + -2 = -42 so the remainder is either 3 or -2. Hence remainder is not a bijection (1:1 function). The existence of two potential answers for the remainder is certainly correct, but the conclusion that remainder is not a binary operation doesn't follow. It is a binary relation. Mathematicians are well able to deal with little inconveniences like this, e.g. consider the square root: 10**2 = 100 (-10)**2 = 100 therefore the square root of 100 is ±10 Mathematicians get around this by defining the square root operator √ as *only* the principle value of the square root relation, that is, the positive root. Hence: √100 = 10 only If you want both roots, you have to explicitly ask for them both: ±√100 Similarly, we can sensibly define the remainder or modulus operator to consistently return a non-negative remainder, or to do what Python does, which is to return a remainder with the same sign as the divisor: 42 % 5 2 -42 % 5 3 42 % -5 -3 -42 % -5 -2 There may be practical or logical reasons for preferring one over the other, but either choice would make remainder a bijection. One might even define two separate functions/operators, one for each behaviour. They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is whatever some dead guy said it was, and they dont know of any dead guy ever talking about a modulus operation, so therefore it 'does not exist'. You've studied the contemporary philosophy of mathematics huh? How about studying some actual mathematics before making such absurd pronouncements on the psychology of mathematicians? -- Steven -- http://mail.python.org/mailman/listinfo/python-list