[Python-Dev] s1 == (sf % (s1 / sf))? A bad idea?

Paul Prescod paulp@ActiveState.com
Tue, 03 Apr 2001 16:45:54 -0700


Peter Funk wrote:
> 
> ...
> 
> I however often like the infix notation better.
> That may be a matter of taste.  Imagine we would have to write:
>         "%5d %20s %s\n".printf((num, name, adr))
> instead of
>         "%5d %20s %s\n" % (num, name, adr)
> I'm happy, that this is not the case in todays Python.

Either way it is infix (as opposed to prefix or postfix). The question
is whether it is an infix *operator* or a method.

I believe that the only thing aesthetically wrong with this:

"%5d %20s %s\n".insert(num, name, adr)

is that people are not "used" to seeing method invocations on literal
strings. But then new Python programmers are not used to seeing people
divide or mod strings either!

And the nice thing about using a method name is that you can look method
names up in the indexes of books easily and even guess the meaning of
them from their English meanings. Symbols are (IMHO) best reserved for
usages where their meanings are already set by real-world convention.
(i.e. 5+3!)

If some other language convinces millions of programmers that string
division is natural then we could follow suit but I'd rather not lead
the way.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook