On 04 April 2000, Ka-Ping Yee said: > On Tue, 4 Apr 2000 gvwilson@nevex.com wrote: > > (BTW, I think '/' vs. '//' is going to be as error-prone as '=' vs. '==', > > but harder to track down, since you'll have to scrutinize values very > > carefully to spot the difference. Haven't done any field tests, > > though...) > > My favourite symbol for integer division is _/ > (read it as "floor-divide"). It makes visually > apparent what is going on. Gaackk! Why is this even an issue? As I recall, Pascal got it right 30 years ago: / is what you learned in grade school (1/2 = 0.5), div is what you learn in first-year undergrad CS (1/2 = 0). Either add a "div" operator or a "div()" builtin to Python and you take care of the spelling issue. (The fixing-old-code issue is another problem entirely.) I think that means I favour keeping operator.div and the __div__() method as-is, and adding operator.fdiv (?) and __fdiv__ for "floating-point" division. In other words: 5 div 3 = 5.__div__(3) = operator.div(5,3) = 1 5 / 3 = 5.__fdiv__(3) = operator.fdiv(5,3) = 1.6666667 (where I have used artistic license in applying __div__ to actual numbers -- you know what I mean). -1 on adding any non-7-bit-ASCII characters to the character set required to express Python; +0 on allowing any (alphanumeric) Unicode character in identifiers (all for Py3k). Not sure what "alphanumeric" means in Unicode, but I'm sure someone has worried about this. Greg
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4