Pep 238 Why new // operator (Non-integer Division)

Tim Peters tim.one at home.com
Sat Mar 17 01:38:17 EST 2001


[Grant Griffin]
> BTW, I guess I'm not the first one to notice that this new operator
> looks an awful lot like a C/C++ comment.

No, you're the first!  329 people did note that // looks an awful lot like
Fortran's string concatenation operator.  I expect these were the same 329
who complained to the C++ committee about abusing *their* prior art.

> So maybe some other symbol should be used.

Why bother?  Python's # looks an awful lot like C++'s preprocessor directive
flag too.  Guido would probably prefer infix "div" (a la Pascal), but a new
keyword is a very hard sell.

> Hey, isn't "$" still open? <wink>

Barry has first dibs on that one, to make

    print $ fileobject, 2, "+ 5% tax =", 2*1.05

print

    $2.00 + $0.10 = $2.10

Curiously, he will ignore the fileobject in this case, unless it's spelled

    print $ >> fileobject, 2, "+ 5% tax =", 2*1.05

I forget what

    print >> $fileobject, 2, "+ 5% tax =", 2*1.05

is going to mean.  I *think* it reads the next line from fileobject, strips
the newline, then uses that as the name of the file to print to (after
opening for append).

> just-tryin'-to-make-a-buck-ly y'rs,

sell-documentation-for-barry's-proposals!-ly y'rs  - tim





More information about the Python-list mailing list