Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16993 > unrolled thread

Verbose and flexible args and kwargs syntax

Started byEelco Hoogendoorn <hoogendoorn.eelco@gmail.com>
First post2011-12-12 00:44 +0100
Last post2011-12-12 13:02 -0500
Articles 20 on this page of 91 — 21 participants

Back to article view | Back to comp.lang.python


Contents

  Verbose and flexible args and kwargs syntax Eelco Hoogendoorn <hoogendoorn.eelco@gmail.com> - 2011-12-12 00:44 +0100
    Re: Verbose and flexible args and kwargs syntax Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-12 01:11 +0000
      Re: Verbose and flexible args and kwargs syntax Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-12-12 21:09 +1300
        Re: Verbose and flexible args and kwargs syntax Terry Reedy <tjreedy@udel.edu> - 2011-12-12 10:36 -0500
        Re: Verbose and flexible args and kwargs syntax Nick Dokos <nicholas.dokos@hp.com> - 2011-12-12 10:55 -0500
        Re: Verbose and flexible args and kwargs syntax Arnaud Delobelle <arnodel@gmail.com> - 2011-12-12 16:15 +0000
        Re: Verbose and flexible args and kwargs syntax Chris Angelico <rosuav@gmail.com> - 2011-12-13 03:16 +1100
        Re: Verbose and flexible args and kwargs syntax Chris Angelico <rosuav@gmail.com> - 2011-12-13 03:19 +1100
      Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 04:21 -0800
        Re: Verbose and flexible args and kwargs syntax Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-12 11:09 -0700
          Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 10:17 -0800
            Re: Verbose and flexible args and kwargs syntax Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-12 11:35 -0700
              Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 10:51 -0800
                Re: Verbose and flexible args and kwargs syntax Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-12 17:34 -0700
                  Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 00:31 -0800
              Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 11:05 -0800
                Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 11:20 -0800
        Re: Verbose and flexible args and kwargs syntax alex23 <wuwei23@gmail.com> - 2011-12-12 15:54 -0800
        Re: Verbose and flexible args and kwargs syntax Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-13 02:43 +0000
          Re: Verbose and flexible args and kwargs syntax Chris Angelico <rosuav@gmail.com> - 2011-12-13 14:08 +1100
          Re: Verbose and flexible args and kwargs syntax Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-12 21:52 -0700
          Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 01:15 -0800
            Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 01:50 -0800
              Re: Verbose and flexible args and kwargs syntax Arnaud Delobelle <arnodel@gmail.com> - 2011-12-13 10:15 +0000
                Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 02:39 -0800
                Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 02:46 -0800
                  Re: Verbose and flexible args and kwargs syntax Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-13 11:28 +0000
                    Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 04:19 -0800
            Re: Verbose and flexible args and kwargs syntax Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-13 11:13 +0000
              Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 04:47 -0800
                Re: Verbose and flexible args and kwargs syntax Chris Angelico <rosuav@gmail.com> - 2011-12-14 00:14 +1100
                  Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 05:35 -0800
      Re: Verbose and flexible args and kwargs syntax "OKB (not okblacke)" <brenNOSPAMbarn@NObrenSPAMbarn.net> - 2011-12-12 19:45 +0000
    Re: Verbose and flexible args and kwargs syntax Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-12 12:59 +0200
      Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 03:22 -0800
        Re: Verbose and flexible args and kwargs syntax Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-12 13:46 +0200
      Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 03:18 -0800
      Re: Verbose and flexible args and kwargs syntax Terry Reedy <tjreedy@udel.edu> - 2011-12-12 10:39 -0500
        Re: Verbose and flexible args and kwargs syntax Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-12 18:52 +0200
          Re: Verbose and flexible args and kwargs syntax Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-12 09:29 -0800
            Re: Verbose and flexible args and kwargs syntax Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-12 20:09 +0200
            % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-14 03:18 +0000
              Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-13 23:49 -0800
                Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Arnaud Delobelle <arnodel@gmail.com> - 2011-12-14 11:55 +0000
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-14 04:33 -0800
                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Arnaud Delobelle <arnodel@gmail.com> - 2011-12-14 16:13 +0000
                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-14 09:15 -0800
                        Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] rusi <rustompmody@gmail.com> - 2011-12-14 19:43 -0800
                          Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-15 01:44 -0800
                            Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] rusi <rustompmody@gmail.com> - 2011-12-15 02:56 -0800
                              Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-15 03:37 -0800
              Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-14 10:56 +0200
                Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-14 02:09 -0800
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-14 14:22 +0200
                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-14 04:41 -0800
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-14 12:38 +0000
                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-14 05:29 -0800
                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Chris Angelico <rosuav@gmail.com> - 2011-12-15 00:39 +1100
                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-14 08:45 -0700
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Terry Reedy <tjreedy@udel.edu> - 2011-12-14 15:57 -0500
                Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] rusi <rustompmody@gmail.com> - 2011-12-14 03:47 -0800
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Chris Angelico <rosuav@gmail.com> - 2011-12-14 22:53 +1100
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-14 15:09 +0200
                Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-14 12:32 +0000
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-14 15:21 +0200
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Robert Kern <robert.kern@gmail.com> - 2011-12-15 10:47 +0000
                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-15 02:59 -0800
                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] alex23 <wuwei23@gmail.com> - 2011-12-15 18:14 -0800
                        Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] MRAB <python@mrabarnett.plus.com> - 2011-12-16 02:58 +0000
                          Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-16 02:36 -0800
                        Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Chris Angelico <rosuav@gmail.com> - 2011-12-16 16:01 +1100
                          Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] alex23 <wuwei23@gmail.com> - 2011-12-15 21:30 -0800
                            Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-16 02:25 -0800
                              Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] rusi <rustompmody@gmail.com> - 2011-12-16 09:38 -0800
                                Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-16 11:40 -0800
                                  Re: % is not an operator [was Re: Verbose and flexible args and   kwargs syntax] Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-12-17 12:49 +1300
                                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Eelco <hoogendoorn.eelco@gmail.com> - 2011-12-16 16:00 -0800
                                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Roy Smith <roy@panix.com> - 2011-12-16 19:03 -0500
                                    Re: % is not an operator [was Re: Verbose and flexible args and   kwargs syntax] Grant Edwards <invalid@invalid.invalid> - 2011-12-17 20:02 +0000
                                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-17 00:54 +0000
                                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] David Robinow <drobinow@gmail.com> - 2011-12-16 21:11 -0500
                  Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Chris Angelico <rosuav@gmail.com> - 2011-12-15 21:58 +1100
                    Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] rusi <rustompmody@gmail.com> - 2011-12-15 03:04 -0800
                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-15 14:48 +0200
                      Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax] Terry Reedy <tjreedy@udel.edu> - 2011-12-15 18:15 -0500
              Re: % is not an operator Paul Rudin <paul.nospam@rudin.co.uk> - 2011-12-14 09:43 +0000
          Re: Verbose and flexible args and kwargs syntax Nick Dokos <nicholas.dokos@hp.com> - 2011-12-12 12:58 -0500
            Re: Verbose and flexible args and kwargs syntax Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2011-12-14 11:04 +0200
    Re: Verbose and flexible args and kwargs syntax gene heskett <gheskett@wdtv.com> - 2011-12-12 12:46 -0500
    Re: Verbose and flexible args and kwargs syntax Dave Angel <d@davea.name> - 2011-12-12 13:04 -0500
    Re: Verbose and flexible args and kwargs syntax Nick Dokos <nicholas.dokos@hp.com> - 2011-12-12 13:02 -0500

Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →


#17197 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

Fromrusi <rustompmody@gmail.com>
Date2011-12-14 03:47 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<851cbabf-60b6-4806-bef5-e16f6089b08d@h37g2000pri.googlegroups.com>
In reply to#17186
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.

[toc] | [prev] | [next] | [standalone]


#17198 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromChris Angelico <rosuav@gmail.com>
Date2011-12-14 22:53 +1100
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<mailman.3636.1323863621.27778.python-list@python.org>
In reply to#17197
On Wed, Dec 14, 2011 at 10:47 PM, rusi <rustompmody@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

[toc] | [prev] | [next] | [standalone]


#17210 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2011-12-14 15:09 +0200
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<qothb13z4df.fsf@ruuvi.it.helsinki.fi>
In reply to#17197
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.)

[toc] | [prev] | [next] | [standalone]


#17203 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-12-14 12:32 +0000
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<4ee89762$0$29979$c3e8da3$5496439d@news.astraweb.com>
In reply to#17186
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 <jpiitula@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

[toc] | [prev] | [next] | [standalone]


#17211 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromJussi Piitulainen <jpiitula@ling.helsinki.fi>
Date2011-12-14 15:21 +0200
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<qotd3brz3tp.fsf@ruuvi.it.helsinki.fi>
In reply to#17203
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.

[toc] | [prev] | [next] | [standalone]


#17258 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromRobert Kern <robert.kern@gmail.com>
Date2011-12-15 10:47 +0000
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<mailman.3666.1323946085.27778.python-list@python.org>
In reply to#17203
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

[toc] | [prev] | [next] | [standalone]


#17263 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromEelco <hoogendoorn.eelco@gmail.com>
Date2011-12-15 02:59 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<beef5de5-01a5-473b-8581-00eee0c54567@g41g2000yqa.googlegroups.com>
In reply to#17258
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.

[toc] | [prev] | [next] | [standalone]


#17324 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

Fromalex23 <wuwei23@gmail.com>
Date2011-12-15 18:14 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<ce3202ee-37d2-4a7c-ba9f-a7b502d242ba@u10g2000prl.googlegroups.com>
In reply to#17263
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.

[toc] | [prev] | [next] | [standalone]


#17326 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromMRAB <python@mrabarnett.plus.com>
Date2011-12-16 02:58 +0000
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<mailman.3711.1324004291.27778.python-list@python.org>
In reply to#17324
On 16/12/2011 02:14, alex23 wrote:
> 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 '%'.

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. :-)

[toc] | [prev] | [next] | [standalone]


#17346 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromEelco <hoogendoorn.eelco@gmail.com>
Date2011-12-16 02:36 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<2a747b91-23bd-4d84-87f7-96609ac3c1dd@ct2g2000vbb.googlegroups.com>
In reply to#17326
On Dec 16, 3:58 am, MRAB <pyt...@mrabarnett.plus.com> wrote:
> On 16/12/2011 02:14, alex23 wrote:
>
> > 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 '%'.
>
> 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.

[toc] | [prev] | [next] | [standalone]


#17329 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromChris Angelico <rosuav@gmail.com>
Date2011-12-16 16:01 +1100
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<mailman.3713.1324011718.27778.python-list@python.org>
In reply to#17324
On Fri, Dec 16, 2011 at 1:58 PM, MRAB <python@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

[toc] | [prev] | [next] | [standalone]


#17332 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

Fromalex23 <wuwei23@gmail.com>
Date2011-12-15 21:30 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<ecd36336-8104-4fc1-b82c-95711cd19024@v31g2000prg.googlegroups.com>
In reply to#17329
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!

[toc] | [prev] | [next] | [standalone]


#17347 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromEelco <hoogendoorn.eelco@gmail.com>
Date2011-12-16 02:25 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<6a0161f3-d349-4a28-b003-793f647c10e4@x7g2000vby.googlegroups.com>
In reply to#17332
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.

[toc] | [prev] | [next] | [standalone]


#17365 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

Fromrusi <rustompmody@gmail.com>
Date2011-12-16 09:38 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<7b7e09cf-f618-4d86-8e5e-81ba1904c75c@k5g2000pra.googlegroups.com>
In reply to#17347
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)

[toc] | [prev] | [next] | [standalone]


#17380 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromEelco <hoogendoorn.eelco@gmail.com>
Date2011-12-16 11:40 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<47fda7c8-1c8a-40c4-8c86-251ec2503cb7@m7g2000vbc.googlegroups.com>
In reply to#17365
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 :).

[toc] | [prev] | [next] | [standalone]


#17392 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromGregory Ewing <greg.ewing@canterbury.ac.nz>
Date2011-12-17 12:49 +1300
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<9l23ntFsibU1@mid.individual.net>
In reply to#17380
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

[toc] | [prev] | [next] | [standalone]


#17394 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromEelco <hoogendoorn.eelco@gmail.com>
Date2011-12-16 16:00 -0800
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<2420abd7-7d91-4bc9-bb3b-d8ec1680ed0c@u32g2000yqe.googlegroups.com>
In reply to#17392
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?

[toc] | [prev] | [next] | [standalone]


#17395 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromRoy Smith <roy@panix.com>
Date2011-12-16 19:03 -0500
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<roy-59FCC6.19032316122011@news.panix.com>
In reply to#17394
In article 
<2420abd7-7d91-4bc9-bb3b-d8ec1680ed0c@u32g2000yqe.googlegroups.com>,
 Eelco <hoogendoorn.eelco@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"

[toc] | [prev] | [next] | [standalone]


#17416 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromGrant Edwards <invalid@invalid.invalid>
Date2011-12-17 20:02 +0000
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<jcish4$4vh$2@reader1.panix.com>
In reply to#17392
On 2011-12-16, Gregory Ewing <greg.ewing@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.edwards        Yow! HUGH BEAUMONT died
                                  at               in 1982!!
                              gmail.com            

[toc] | [prev] | [next] | [standalone]


#17397 — Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2011-12-17 00:54 +0000
SubjectRe: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]
Message-ID<4eebe83f$0$29979$c3e8da3$5496439d@news.astraweb.com>
In reply to#17380
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

[toc] | [prev] | [next] | [standalone]


Page 4 of 5 — ← Prev page 1 2 3 [4] 5  Next page →

Back to top | Article view | comp.lang.python


csiph-web