r/ProgrammerHumor May 27 '22

Meme Welcome to hassle free coding

Post image
2.3k Upvotes

305 comments sorted by

View all comments

Show parent comments

172

u/oddmerlin373 May 27 '22

Honestly I prefer to call it a scripting language because that’s what it’s good at

98

u/ashum048 May 27 '22

Yes, yes, yes.

Automating stuff with python and creating small apps is a blessing.

Debugging large scale applications in python is pain.

58

u/prescod May 28 '22

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

43

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

5

u/HgnX May 28 '22

Man needs a bit of PyLance in his life

7

u/juhotuho10 May 28 '22

Python can be turned to strictly typed with type hints and mypy

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/

6

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.

0

u/unknowntillnow23 May 28 '22

Are you building large systems in python alone. Someone doing some voodoo shit in python would be picked up by the commit hooks or in a code review at the very least.

7

u/AltAccountMfer May 28 '22

I always hear this response and my rebuttal is that it shouldn’t have to get that far.

3

u/LEGOL2 May 28 '22

That's... my job. My work is debugging drivers 24/7 <pain>

12

u/[deleted] May 27 '22

I heard it's pretty good at data

13

u/0430ke May 28 '22

Yeah I primarily use it for data and database shit. It's much faster to write and run something quick that manipulates a lot of data quickly.

It's also incredibly nice due the fact that almost EVERYTHING has an API for Python. So you can gather data from many sources all in one place, easy to write, quick to run.

Edit: To add on to this, it's also easy to manipulate data types since it's easy to cast data to other types. JSON is super easy to use, etc. Using other languages you have to really mess around with getting the data type you want. Python just makes it easier.

5

u/ashum048 May 28 '22

Agree. Data is another place where python really shines.

Create a simple data pipe or a NN in python is fun.

4

u/Thathitmann May 27 '22

It's got some nice built in functions to quickly save and load to/from JSON files, and with addons it can handle about any file types.

It takes about 2 lines of very easy to read code to import/export data.

7

u/prescod May 28 '22

Yes and it is also very good at doing gigantic matrix multiplies spread over multiple computers in a cluster. I think that's actually what's meant by "good at data."

5

u/[deleted] May 28 '22

I'm studying python in school but not real world applications

From what I've seen and from what I've heard from better programmers it's good for data analysis

1

u/Hot_Slice May 29 '22

That code is all written in C. Literally all the fast and powerful bits of Python are C.

Write a gigantic networked matrix multiply in pure Python and it would be dog slow

1

u/prescod May 29 '22

People always bring this up as if it is relevant. I don't see how it is relevant to the people trying to do the matrix multiply whether it is implemented in C or Python. A (sane) C programmer would call out to BLAS/LAPACK just as a Python programmer calls out to Numpy.

5

u/ddtfrog May 28 '22

I like it for front end automation and web scraping, too.

2

u/ashum048 May 28 '22

true. Any automation in python becomes so much clearer than a bunch of shell scripts all over the place. Not against shell scripts. Don't want to start a war)

1

u/ddtfrog May 28 '22

But as someone who learned C++ / C first, it’s a scripting language to me lol.

-1

u/jswitzer May 28 '22

Refactoring is fun; random indents and spaces/tabs can determine if it compiles, fails during execution, or does weird things.

1

u/Yokhen May 28 '22

So much pain

17

u/[deleted] May 27 '22

are we not calling it a scripting language anymore?

8

u/mooscimol May 28 '22

Scripting is one of the purposes, but really not the biggest one IMO. It is interpreted, dynamically typed language, opposite to eg. complied, statically typed languages like C.

1

u/oddmerlin373 May 27 '22

Apparently, even on the python site they call it a programming language. Even though I don’t think it was ever meant as one

10

u/banmedaddy12345 May 28 '22

6

u/LightRefrac May 28 '22

And YouTube

3

u/Hlorri May 28 '22

Hence, the buggy copy&paste?

10

u/[deleted] May 27 '22

[removed] — view removed comment

4

u/teastain May 27 '22

Wisdom of Solomon.

3

u/[deleted] May 27 '22

Be nice or Ill split C++ into C+, Python+ and Java-

3

u/Hayden2332 May 28 '22

Scripting languages are a subset of programming languages. Just like compiled languages are a subset of programming languages

13

u/prescod May 28 '22

Yeah it's good at scripting.

And machine learning.

And data science.

And teaching.

And Web development.

And biological computing.

And...

But let's just call it a "scripting language".

8

u/nickwcy May 28 '22

Machine learning: CUDA / Tensorflow is written in C

Data Science: Numpy is written in C

Web development: Absolutely not. Python is good for POC/classwork, but never highly maintainable for enterprise use.

What Python is really good at is small pieces of code like CI/CD scripts, or serverless functions.

17

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

Nick: do they machine learning folks mostly write C or Python?

I’m not asking what language their runtime is implemented in. I’m asking what language the programmers program in.

With respect to web apps. Let me list a few startups that were written in Python at the time they got famous (before being refactored into dozens of microservices written in a hodgepodge of languages).

Youtube. Reddit. Instagram, D-wave. To name a few.

Have you built an app that succeeded to that extent?

If not, what is your evidence that Python cannot be used for web apps given that clear evidence of success?

2

u/nickwcy May 28 '22

Depends on what you meant by machine learning folks. They program the logic in C, you don’t see back propagations for MLP nor need to write the bagging logic for random forest.

Calling a library does not mean you engineered it.

And having business success does not mean they have chosen the right language for web development. Nor it has anything to do with maintainability. They will be successful even if they have chosen Java, C# or other languages, because of their brillient ideas, not because they are using Python.

13

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

Most data scientist know Python. A smaller percentage know C.

This is also true (though to a lesser degree) for machine learning programmers. More work in Python than C.

Calling libraries to solve problems does make you an engineer. Solving the problem is the defining characteristic of engineers. C programmers call a lot of libraries too.

Business success is the ultimate result of technical success. Am I saying they would have failed in another language? No. But you implied that they should have failed in Python. They didn’t.

Python solves the problems that dynamic businesses need to solve. That’s really all there is to it. You have a distaste for it and therefore you want to make a fact-free claim that it’s the wrong tool. But reality and evidence are against you.

2

u/BeanieTheTechie May 27 '22

its really multipurpose

-5

u/jamcdonald120 May 27 '22

Its an excelent scripting language. Just the tthing if you want to write a basic commandline utility for some repetative task.

And then people try to use it as a web backend

18

u/prescod May 28 '22

Yeah, dumb people making useless products like YouTube, Reddit, Dropbox and Instagram. I guess your startups have had more success with "real" programming languages.

-7

u/jamcdonald120 May 28 '22

hey look, someone who doesnt know what micro services are and equates good coding practice with good business practices.

11

u/prescod May 28 '22

WTF are you even talking about?

I didn’t say anything about microservices/monoliths at all.

13

u/tripledjr May 28 '22

hey look, a gate-keeping elitist that doesn't understand trade offs and using different programming languages in different scenarios.

Also what the hell does the chosen language have to do with micro services vs monolith?

5

u/Hayden2332 May 28 '22

Hey look, someone who’s never programmed in the real world since they were born

1

u/BitterAndJaded120 May 28 '22

Tbf, not all of us can be Guido or Bjarne