Hacker Newsnew | past | comments | ask | show | jobs | submit | lisael's commentslogin

GP told about "a government". You rephrased to "The people running our society". If we accept the fact that this people is, simply put, the rich and the giant corporations... they have a lot to gain from some kind of fascist society. That's the heart of fascism: a strong government serving the rich. They do have to gain a lot from the masses ignorance, irrationality and short sight. Not that I'm saying they all adhere to fascism, people may have principles that contradict their most direct interest.


Multinational corporations don't like nationalism. I think the idea that big corporations benefit from fascism is an interesting one, but it doesn't square with capitalism's need to keep borders open to trade and capital flow. If you're proposing that someone is going to invent a non-nationalist version of fascism, that's again an interesting idea, but I'm having a hard time imagining it.


If it's successful it won't get a name, it won't be a "thing," it will just be the new normal.


FWIW Pypy used to share this behaviour. It was clearly a bug, as it doesn't follow CPython convention.

It's around since 2013 and was found in a unit test coverage improvement effort in Feb. 2018.

Given that pypy is mostly used for hard-core math and scientific computations, how the hell this bug wasn't found earlier by a user ?

My bet is that ZeroDivisionErrors are very rare. Do you even remember a ZeroDivisionError in production code ? I don't.

1/0 is my dirty little trick to add a breakpoint when I'm too lazy to launch a debuger. Why does this work? Here again, because nobody never catch ZeroDivisionErrors, because they don't happen.

So, what a fuss for such a tiny convention. Granted, it breaks the math correctness, as do ±Infinity. CPU integer math is broken anyway. In what world does 2^31 - 1 + 1 == -2^31 ?

I took a fairly large, used and old repository, Django and I search for ZeroDivisionError:

https://github.com/django/django/search?q=ZeroDivisionError&...

guess what:

- 4 occurrences in the tests

- 3 occurences in the issues

- last, but not least 1 occurrence in the code:

   except ZeroDivisionError:
       result = '0'


To elaborate on the 'nice little shortcut' you mentioned, here it is:

If a==b and N≠0, then x==y

EDIT: Formatting


No, that is not necessary.

"Given an x, y, and N such that x/N == y/N, it is true that x == y".

There is no need to say N != 0 under the ordinary definition of division.


(a + b)/c = a/c + b/c for c ≠ 0. Otherwise it has no meaning.

Therefore (2 + 1)/0 = 2/0 + 1/0 is not even false, it just means nothing.

BTW, you didn't mention Infinity explicitly, but it would lead to the same inconsistency, if you think about it:

(2 - 1)/0 = 2/0 - 1/0

:)


If you define a/0 to be a value, then you can ask whether (2 + 1)/0 = 2/0 + 1/0. This is not meaningless since both sides are defined. If you define a/0 = 2, then the equation is false.

Using "infinity" (which is not how it's actually done in math) requires you to rule out the possibility of operations like infinity - infinity.


Meanwhile, in Python...

  In [1]: 255 + 1 is 256
  Out[1]: True
  In [2]: 256 + 1 is 257
  Out[2]: False
Every language has its inconsistencies, when it comes to math, because they run on real-world computers. All these are "slow" interpreted languages that allow runtime failures and don't use plain machine integers. Just a different trade-off.

Anyway, the Inf/NaN trick is not better than the 0 trick in my opinion, because all subsequent operations result happily in NaN. I've never seen in any NaN language a program that checks for NaN the result of each and every division.

with a NaN-kind of language, it would be:

  a = b/c
  if a == NaN:
    print "oops"
with a 0-trick language:

  a = b/c
  if a == 0 and c == 0:
    print "oops"
not THAT different, IMO :)


When I make a language, there will be a OuchMyHeadHurtsCommaSpaceGotSomeAspirinQuestionMarkError.


Pony does have exceptions, and indexing an array does raise if the index is out of bound. It doen't have runtime errors because all exception must be handled somewhere in the call stack, the sooner, the better.

Because of this rule, defining / as a partial function forces the user to fence every single division in a try clause.

Using boxed integer as Elm does is not an option as Pony targets high-speed computing, not browser rendering. Different fields, different trade-offs.

Defensive users can well define `div(I32, I32): I32?` that throws an error and use it instead of `/`.

As repeated in this thread, 1/0 is undefined because nonsensical. So, it's OK to have any sane, consistent and well documented behaviour. At least with Pony, the user can choose speed and convenience when they're sure there is no possible 0 at this place. Well, TBH, I think it's always the case. Because there is no such thing as a division by zero, you're algorithm is simply wrong and unsound if it ends up dividing by 0, and that's where this case differs from integer overflow

Note: in Pony literature, "partial" means "can throw an error". "partial" as in "doesn't apply to the whole domain of the arguments types"


And please, don't break / either. Github and docs.python.org for instance don't play nice for vim users.


Anything that silently sends informations about your users to a third party is nasty by nature, including google analytics, gravatar, disqus, +1/like buttons and many more. Please, web designers, think twice before selling all your users to gain little convenience.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: