barubary

joined 2 years ago
[–] [email protected] 20 points 3 days ago* (last edited 3 days ago)

I like the original.

Comic by Jason Heeris, 2013. Panel 1: Person staring at screen with code: if c == ',': backtrack = 1 Panel 2: Zoomed out. Code now in big thought bubble Panel 3: Zoomed out more. Thought bubble: "... so if the current character is a comma, we set the backtracking flag ..." Panel 4: Zoomed out more. Thought bubble fills half the panel. It shows a state diagram, presumably part of a finite automaton corresponding to a regular expression. Panel 5: Zoomed out more. Thought bubble fills most of the panel. Flowchart. Step "parse" leads to decision "-i flag"; one branch to box with previous state diagram (scaled down), other branch to step "remote config", then decision "https" with branches out of visible area. Panel 6: Zoomed out more. Huge thought bubble with scribbled diagrams and notes and arrows connecting them. E.g. "commit #5763 to here caused bug or did it just expose it?", pointing to "new config format parser" and "callback for config state"; "CLI entry point" has a note on it saying "Sarah wrote this, maybe ask about weird parse logic?"; "remote config loader" has a note "no access to source - are we just recalculating its state later?". Panel 7: Back to normal zoom. Another person with a tie and coffee in hand peers over the screen: "Hey, so I just sent you an email about that thing". The thought bubble is collapsing into a black hole. Panel 8: Tie/coffee guy is walking off, whistling. Original person is back to staring at screen with code: if c == ',': backtrack = 1

[–] [email protected] 6 points 2 weeks ago (1 children)
$ python3 -c 'f = (lambda x: x + 0.5 - 0.5); print(f(2**52))'  4503599627370495.5

#python

[–] [email protected] 66 points 2 weeks ago (1 children)

If you had let me write the C++ code, I could have literally destroyed your dataset in a couple of seconds.

[–] [email protected] 0 points 2 weeks ago (1 children)

I believe now it is my turn to say you're spewing nonsense. Have you ever used a language with a type system? Because this whole idea of "testing external data to see if it is the right type" doesn't really make sense.

At the lowest layer, generally, external data is an array of bytes. It has no other type you could "test". However, you can decode or parse it into a form that makes sense for your program. And why couldn't I cleanly recover from parse errors? (And how do you think Python does it?)

[–] [email protected] -1 points 2 weeks ago (3 children)

Again, "strong types" doesn't mean anything.

But from a type theory perspective, having "dynamic types" absolutely means you don't have a type system. All Python has is runtime exceptions. The fact that one of them is named TypeError doesn't make it a type error in the formal sense.

The point of a type system is not that variables have types, but that types are assigned to expressions (i.e. pieces of code in your source file), not to values (i.e. pieces of data). This is important because it guarantees that certain errors cannot occur in a program that passes the type checker (assuming you have a sensible/useful type system). And you get this assurance without running a single line of code.

To get a similar guarantee from Python, you need to write exhaustive tests, just as with any other runtime error.

[–] [email protected] -3 points 2 weeks ago (5 children)

"Strongly typed" is meaningless. (Or nearly so; in practice it means "I like this language" and "weakly typed" means "I dislike this language".) The point is that Python has no type system.

[–] [email protected] -3 points 2 weeks ago (7 children)

Python is un(i)typed.

[–] [email protected] 8 points 2 weeks ago (1 children)
[–] [email protected] 6 points 3 weeks ago

Only since 2014, so barely over a decade.

[–] [email protected] 3 points 3 weeks ago (1 children)

CPU? It's called a modem!!

[–] [email protected] 1 points 3 weeks ago

Isn't it just two clicks in matrix mode?

[–] [email protected] 5 points 3 weeks ago (2 children)

BTW, you can configure uBlock Origin to block all 3rd party javascript by default, but allow 1st party scripts, so you don't even need NoScript to get most of these benefits.

view more: next ›