One of these days, when the mood strikes, I'll upload the matlab script I inherited from my Ph.D supervisor.
Scientific programming is, by and large, an abysmal state of affairs.
One of these days, when the mood strikes, I'll upload the matlab script I inherited from my Ph.D supervisor.
Scientific programming is, by and large, an abysmal state of affairs.
I will never forget my gut wrenching feeling when I opened up one of the main provisioning scripts (in Python) to read the first two lines:
True = 0
False = -1
The rest of it was an unmaintainable disaster that may have worked. I learned so much that summer, having been forced to learn it all myself. True = 0
False = -1
<<Could you please explain what is so egregious about those two lines for those people that may not see it? Asking for a friend.
However maybe the professor needed 'true/false' to represent something to be used in his formulas so this made sense to him. But who knows.
This script is changing it to be backwards, and python is flexible enough to allow that. But I would expect this would break most python libraries, because it's such a core language feature that's being completely restructured.
Is there a valid use case for changing the numeric values of True and False?
No! Actually I take it back this _is_ definitely still a terrible idea and will lead to certain madness for all involved. :)
Python 2 has _many_ quirks like this one. Python 3 was not just "it's unicode".
[1] https://docs.python.org/3/whatsnew/3.0.html#changed-syntax
(Python has a search path: it looks first on the current module, then on the built-in __builtins__ module, which is where the built-in constants and functions reside.)
>>> True = 0
>>> False = -1
>>> if False: print('oh no')
False is now truthy and True is falsey. Note this only works in python2.https://codesearch.debian.net/search?q=%28%3Fm%29%5E%5Cs%2AT...