r/ProgrammerHumor May 27 '22

Meme Welcome to hassle free coding

Post image
2.2k Upvotes

305 comments sorted by

View all comments

Show parent comments

56

u/prescod May 28 '22

Debugging large scale applications is a pain...period.

46

u/[deleted] May 28 '22

Strictly typed languages are much easier to debug though IMO. Python and JS will let you do extremely weird stuff that’s hard to pick out in debugging, where in a C-based language it would just give you a compiler error

12

u/prescod May 28 '22

And C will let you do bad things with memory where Python would just give you a runtime error.

If you want tons of compile time errors, Python's type system is vastly more powerful and precise than C's:

https://mypy.readthedocs.io/en/latest/

5

u/ShelZuuz May 28 '22 edited May 28 '22

That’s the old “chainsaws are dangerous so let’s use a nail file to chop off the tree” argument.

Also the common set of libraries you use in python are almost never statically types so the linter doesn’t really help.

2

u/prescod May 28 '22 edited May 28 '22

That’s the old “chainsaws are dangerous so let’s use a nail file to chop off the tree” argument.

Not at all. It's "axes (C) and chainsaws (Python) are both dangerous and let's not BS ourselves about that."

If you have a high standard for static correctness then you use Rust or Haskell, not C or Python. C is MUCH more dangerous than Python, as the thousands of "use after free" and "buffer overflow" security vulnerabilities show.

https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=buffer+overflow

https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=use+after+free

https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=null+pointer

It's ridiculous to point to C as an example of a "safer" language in the face of enormous real-world evidence that it is not.

Also the common set of libraries you use in python are almost never statically types so the linter doesn’t really help.

What's your favorite Python library that is not typed?

Django: https://github.com/typeddjango/django-stubs

LXML: https://github.com/lxml/lxml-stubs

Numpy: https://numpy.org/devdocs/reference/typing.html

SQL Alchemy: https://github.com/dropbox/sqlalchemy-stubs

The whole Python Standard Library: https://github.com/python/typeshed/tree/master/stdlib

Tons and tons of other third party libraries: https://github.com/python/typeshed/tree/master/stubs

And if you find something missing, you can add a type stub to your own project or contribute it to typeshed or make a new project for it.