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

Eelco hoogendoorn.eelco at gmail.com
Fri Dec 16 05:36:50 EST 2011


On Dec 16, 3:58 am, MRAB <pyt... at mrabarnett.plus.com> wrote:
> On 16/12/2011 02:14, alex23 wrote:
>
> > Eelco<hoogendoorn.ee... at 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.



More information about the Python-list mailing list