Clearly the issue of changing the semantics of division is a very [ahem] divisive one in the Python community. It seems to me that providing a foolproof way of providing backwards compatibility would go a long way to reducing the ire of those with a lot of code to inspect and change. I'm not particularly thrilled with the suggestions made so far. Suggesting that people continue to use an older version of Python if they have a problem with it is especially unsatisfying. Eventually that older version will have to be updated in some manner (resulting in a fork of Python) or they will have to make the necessary changes to their code (albeit over a longer time). Providing a new division operator (//) that handles integer division doesn't really solve the issue of inspecting the code either. There isn't any automatic way of telling when / or // should be used in old code. Command line switches or other mechanisms to indicate that division should have different behavior will confuse those trying to understand source code ("is this '/' a new or old division?"). Why not provide yet another division operator for backwards compatibility purpose? This operator would have exactly the same semantics as the current division operator. If this were available, it should be a relatively simple matter to provide a tool to convert all uses of the / operator to the new form for old code. With this solution, the code never has to be manually inspected to work with the new version, instead, it just has to be mechanically translated. The fact that the operator has different semantics will be evident in the translated code. I don't know what the best name or symbol would be (olddiv, ///?) and admittedly it is ugly to have 3 division operators. But the alternatives seem far, far uglier. Isn't this a case where practicality beats purity (for keywords or operators)? Perry Greenfield
participants (1)
-
Perry Greenfield