Andrew McNabb wrote:
On Sat, Oct 06, 2012 at 08:41:05AM +1000, Steven D'Aprano wrote:
On 06/10/12 05:53, Andrew McNabb wrote:
Path concatenation is obviously not a form of division, so it makes little sense to use the division operator for this purpose. But / is not just a division operator. It is also used for:
* alternatives: "tea and/or coffee, breakfast/lunch/dinner" * italic markup: "some apps use /slashes/ for italics" * instead of line breaks when quoting poetry * abbreviations such as n/a b/w c/o and even w/ (not applicable, between, care of, with) * date separator
This is the difference between C++ style operators, where the only thing that matters is what the operator symbol looks like, and Python style operators, where an operator symbol is just syntactic sugar. In Python, the "/" is synonymous with `operator.div` and is defined in terms of the `__div__` special method. This distinction is why I hate operator overloading in C++ but like it in Python.
'/' is just a symbol. One common interpretation is as division, but that is not its only purpose. It's not even one of the first two symbols I learned for division when I was younger. ~Ethan~