News for hackers. Stuff that matters.
Re:Statically-typed error handling in Python using Mypy by pytester on Sunday December 08, 2019 @02:05PM (#21737535)
Coz there's a difference between "dynamic type system" and "type system that's thrown together with bits of string and rubber bands":

https://www.destroyallsoftware.com/talks/wat

Re:Statically-typed error handling in Python using Mypy by staticassertion on Sunday December 08, 2019 @02:09PM (#21737573)
Python has is own 'wat' stuff, especially Python 2.

https://stackoverflow.com/questions/3270680/how-does-python-...

"CPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don’t support proper comparison are ordered by their address."

Re:Statically-typed error handling in Python using Mypy by detaro on Sunday December 08, 2019 @03:14PM (#21737999)
> objects of different types always compare unequal, and are ordered consistently but arbitrarily

Seems like a completely reasonable thing to do?

Re:Statically-typed error handling in Python using Mypy by staticassertion on Sunday December 08, 2019 @05:44PM (#21738954)
> When you order two incompatible types where neither is numeric, they are ordered by the alphabetical order of their typenames:

????????

Re:Statically-typed error handling in Python using Mypy by detaro on Sunday December 08, 2019 @08:51PM (#21739833)
That's entirely an implementation detail. The thing that matters for programmer experience is the specification of behavior: There's going to be an arbitrary order. You certainly can argue that you think it would be less surprising if trying this just failed, or that promising a stable order ties down implementations too much, but I don't think providing an order is that surprising.

None (as far as I remember) of the common "wat" examples about JS are interpreter implementation details, but specified behavior.

I'm mildly curious why CPython chooses to implement it this way, but if I had to guess: I'm assuming it is to provide a stable order between objects of different classes with the same hash() value. Hash-value being what I suspect is what the quoted answer misrepresents as "their address" (the address being in CPython the default fallback for objects that do not implement a hash() function), and being a good candidate to establish an arbitrary order.

Re:Statically-typed error handling in Python using Mypy by staticassertion on Monday December 09, 2019 @01:52AM (#21740870)
Sorry, I'm not sure I understand at all the difference between this and the 'wat' stuff.
Re:Statically-typed error handling in Python using Mypy by icebraining on Sunday December 08, 2019 @08:32PM (#21739774)
That's just GIGO. There's simply no good way to order "two incompatible types where neither is numeric".
Re:Statically-typed error handling in Python using Mypy by int_19h on Sunday December 08, 2019 @11:21PM (#21740376)
There's always an option to just treat it as an error, especially given that 1+"2" already is.
Re:Statically-typed error handling in Python using Mypy by pytester on Sunday December 08, 2019 @03:05PM (#21737952)
None of those surprising behaviors exist in python 3.

I wouldn't say "100" < "2" really counts, since, alphabetically it makes sense (an equivalent would be "baa" < "c").

Re:Statically-typed error handling in Python using Mypy by staticassertion on Sunday December 08, 2019 @05:45PM (#21738960)
Yes, Python2 was called out explicitly. Reference equality is definitely 'wat' shit IMO, though it's really mainstream too.
Re:Statically-typed error handling in Python using Mypy by karlicoss on Sunday December 08, 2019 @02:10PM (#21737576)
Honestly, with JS flow (https://flow.org) it's very manageable, I almost never have WAT sort of issues
Re:Statically-typed error handling in Python using Mypy by tuesdayrain on Sunday December 08, 2019 @05:27PM (#21738862)
I don't see any reason to use Flow over TS.
Re:Statically-typed error handling in Python using Mypy by karlicoss on Sunday December 08, 2019 @05:36PM (#21738906)
Maybe! But I had to implement some tools (chrome extensions) on Javascript with no prior JS experience, so was trying to stick to vanilla side.