this post was submitted on 16 Sep 2024
225 points (83.6% liked)

Programmer Humor

19463 readers
376 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 43 comments
sorted by: hot top controversial new old
[–] marcos@lemmy.world 63 points 1 month ago

None of that is "Python". You want to learn a language and automatically know everything there is to know using Math?

[–] Bougie_Birdie@lemmy.blahaj.zone 52 points 1 month ago

A hammer is beginner friendly, but learning to use a hammer doesn't necessarily mean you're ready to build a house with it.

[–] UndercoverUlrikHD@programming.dev 45 points 1 month ago (1 children)

The sea should be marked as C considering that's what you'll discover when you get deep into it.

[–] _stranger_@lemmy.world 17 points 1 month ago* (last edited 1 month ago) (1 children)

https://en.m.wikipedia.org/wiki/PyPy

Their greatest mistake was not naming it Ouroboros.

[–] BatmanAoD@programming.dev 10 points 1 month ago (2 children)

The reason C becomes relevant to Python users isn't typically because the interpreter is written in C, but because so many important libraries (especially numpy) are implemented in C.

[–] _stranger_@lemmy.world 5 points 1 month ago

Oh for sure, and some of those are not ok with swapping the interpreter out 🤣

[–] Corbin@programming.dev 2 points 1 month ago (1 children)

Extension modules are implemented in C because the interpreter is written in C. If it were written in another language, folks would write extension modules for that language instead. Also, it would be less relevant if people used portable C bindings like cffi, which are portable to PyPy and other interpreters… but they don't.

[–] BatmanAoD@programming.dev 0 points 1 month ago

Extension modules can be, and are, written in Rust and C++. And PyPy has a compatibility layer to run extensions (such as numpy) that are written for CPython.

The reason extension modules are typically in C is of course the API is in C, but that's true of cffi as well (though you're right that cffi is more portable). And the reason the API is in C is more fundamental than "CPython is written in C".

[–] calcopiritus@lemmy.world 36 points 1 month ago (1 children)

The mistake was choosing a language, and afterwards searching for a use to the language you just learned.

[–] AdNecrias@lemmy.pt 5 points 1 month ago (1 children)

Among all of them at least python is the choice generically people learn when they don't want to learn programming, just want to program stuff as a helper tool to manage data. For those, python is just fine and the learning material around is tailored to for that.

That's how you trick people into programming. You then see people making scripts that take days to run, but it's fine, they're only going to use it twice and are busy enough to be able to wait

[–] PapstJL4U@lemmy.world 5 points 1 month ago

You then see people making scripts that take days to run, but it's fine, they're only going to use it twice and are busy enough to be able to wait

Sponsored by "terrible python code by Matt Parker"

[–] cbazero@programming.dev 22 points 1 month ago (3 children)

Dynamic typing, special and unique syntax for every language feature, interpreter intrinsics

[–] tux0r@feddit.org 16 points 1 month ago (2 children)

Dynamic typing is the source of very amazing errors, see JavaScript.

[–] sus@programming.dev 9 points 1 month ago (1 children)

I think the problems there are exacerbated a lot by over-eager type coercion and other crappy design decisions inherited from almost 30 years ago

[–] barsoap@lemm.ee 5 points 1 month ago

Yep lua and lisp/scheme are also unityped and not even close to as broken. All are remarkably similar languages, theory-wise.

...also something something Guido not getting tail call elimination and people sending him copies of the wizard book. It's been a while.

(And, yes, lua does proper tail calls).

[–] Brahvim@lemmy.kde.social 5 points 1 month ago

[object Object]

!Reddit moment.!<

[–] joyjoy@lemm.ee 7 points 1 month ago (1 children)

Operator overloads, descriptor protocol, decorators

[–] xmunk@sh.itjust.works 7 points 1 month ago (1 children)

Operator overloads are excellent for readable code when used well - I object to their inclusion on this list.

[–] joyjoy@lemm.ee 5 points 1 month ago

As long as you don't have to implement it yourself.

[–] TheHarpyEagle@pawb.social 3 points 1 month ago

Honestly, I've been using type hints very heavily since they became a thing. I just use IDE completion too much to do without them.

[–] tux0r@feddit.org 16 points 1 month ago (6 children)

For all of those, Lisp is the more logical choice. Plus, whitespace as syntax is the worst possible design decision.

[–] BombOmOm@lemmy.world 24 points 1 month ago (1 children)

Ok, but what if an entire programming language is made of whitespace?

https://en.wikipedia.org/wiki/Whitespace_(programming_language)

[–] tux0r@feddit.org 11 points 1 month ago

Still easier to refactor than Python. ;-)

[–] MajorHavoc@programming.dev 14 points 1 month ago* (last edited 1 month ago) (2 children)

Lisp is the more logical choice.

Relevant XKCD. Python has replaced Perl, but things have otherwise changed quite little.

[–] vk6flab@lemmy.radio 6 points 1 month ago* (last edited 1 month ago) (3 children)

Perl is the only language that looks just as incomprehensible before and after a rot13 transformation.

Python on the other hand is the only language that will cause your application to stop working because you mixed up tabs and spaces, even though it looks perfectly fine on your scr.

And lisp is hard to say if you have one.

Edit: aa -> after a

[–] Overspark@feddit.nl 5 points 1 month ago

It is absolutely fine to mix tabs and spaces in Python, as long as you are consistent about it. It's not recommended though, as it's easy to mess up if you're not paying attention. Most IDE's will convert tabs to spaces anyway so it's a bit of a non-issue.

[–] MajorHavoc@programming.dev 2 points 1 month ago

Perl is the only language that looks just as incomprehensible before and aa rot13 transformation.

Lol. You're not wrong.

[–] cfi@lemmy.world 2 points 1 month ago

Perl is the only language that looks just as incomprehensible before and after a rot13 transformation.

APL would like a word, though I imagine ROT13 on APL source code might actually be horrific.

[–] tux0r@feddit.org 4 points 1 month ago (1 children)

I still write more Perl than Python these days.

[–] MajorHavoc@programming.dev 2 points 1 month ago (1 children)

I'm kinda jealous. I don't miss maintaining production Perl code, but Perl was more fun to code in.

[–] tux0r@feddit.org 3 points 1 month ago

Feel free, it’s still out there!

[–] Scoopta@programming.dev 9 points 1 month ago (1 children)

That syntax decision is single handedly why I avoid python if possible

[–] MonkderVierte@lemmy.ml 9 points 1 month ago (1 children)

For me it's dependency hell. Almost as bad as npm.

[–] Scoopta@programming.dev 5 points 1 month ago (2 children)

...is it truly that bad? npm is the reason I don't even install software based on node on my machines... python doesn't seem nearly as bad by comparison? (I run it, just don't like to write it) Maybe it's worse than I realize

[–] calcopiritus@lemmy.world 5 points 1 month ago (1 children)

I haven't used npm. But pip is horrible. Some times I've used a well-known library that only works on linux, but there is no mention of it whatsoever, and it installs without problem. The error only happens at run-time (not even when importing!) and says nothing about platform-dependency. I only learned that it was a linux-only library because I happened to try running it on a Linux machine to see if it worked.

Many times you have to set up your environment a specific way (environment variables, PATH, install dependencies outside of pip) for it to work, and there's no mention of it anywhere. Sometimes you install the library with pip, sometimes with apt, and there is no way to know which one. And sometimes the library is both in apt and pip, but the pip one does nothing.

Furthermore, good luck importing a library. You might have installed it with "pip install my-library" but to import it you have to do "import MyAwesomeLibrary3". And pip won't tell you about that.

[–] Scoopta@programming.dev 3 points 1 month ago

Wow that sounds like a headache, even though I've avoided python for other reasons that sounds like an additional reason to do so. Also the reason I avoid npm isn't for a technical reason like you've outlined here. It's because even installing npm requires me to install an entire other Linux distros worth of packages. Why do I need to install like 100+ new packages just to use a freaking package manager????

[–] MonkderVierte@lemmy.ml 3 points 1 month ago* (last edited 1 month ago)

Not as bad. But if a bigger tool like Paperplane doesn't run after an update, it's likely some changed dependency in python.

[–] joyjoy@lemm.ee 3 points 1 month ago* (last edited 1 month ago) (1 children)

You say that, then use a language that allows you to do this (it's not lisp)

if (foo);
{
  bar();
}
[–] tux0r@feddit.org 4 points 1 month ago* (last edited 1 month ago)

You can make embarrassing mistakes in virtually any programming language that's not too esoteric.

When I still used Python for prototyping (today, I usually use Go for that), it happened much too often that I did this:

if foo:
    bar()
   foobar() # syntax error

In Lisp, however, both errors are much harder to make (not even considering GNU Emacs's superb auto-indentation - which is what most Lispers use these days, as far as I know):

(when foo)  ;; <- obvious!
    (bar))
(when foo
    (bar)
          (foobar)  ;; <- still valid
(quux))  ;; <- also still valid
[–] TheHarpyEagle@pawb.social 3 points 1 month ago

I've had very few issues with whitespace in my decade or so of using python, especially since git and IDEs do a lot to standardize it. I'm a Python simp, tho

[–] Aatube@kbin.melroy.org 2 points 1 month ago

I mean, their goal was readability, and at least they're trying new things.

[–] Kojichan@lemmy.world 2 points 1 month ago

Was this made with AI?

[–] Swedneck@discuss.tchncs.de 1 points 1 month ago

we really need a proper beginner-friendly language that has no maths