this post was submitted on 02 Oct 2023
1751 points (98.0% liked)

Programmer Humor

32175 readers
1151 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Rooki@lemmy.world 45 points 1 year ago (3 children)

Boy oh boy, you gonna hate like a sith if you find out how sh*tty python is.

[–] lud@lemm.ee 43 points 1 year ago (5 children)

Or bash.

So incredibly annoying too read.

There's a glorious project out there that will compile a special typed language into sh compatible script code. The idea is solid, but reading the resulting script files make me want to go back to reading C++ templates.

[–] Hazzia@discuss.tchncs.de 9 points 1 year ago (2 children)

I know that there are use cases for [ ] over [[ ]]. There have to be. Why in god's name would [ ] exist if there wasn't a reason to use it over [[ ]]? I'm obviously the one in the wrong by only ever using [[ ]], because [ ] would definitely be better in some type of situations that I'm just not seeing clearly. Right???

[–] hisbaan@lemm.ee 11 points 1 year ago (2 children)

I believe the reason is that bash is backwards compatible with sh and sh only has [ ], not [[ ]]

[–] float@feddit.de 6 points 1 year ago

[ is a binary (sometimes a symlink) in /usr/bin. It's /usr/bin/[ 🤓

[–] Number358@lemmy.world 5 points 1 year ago (2 children)

Solution: fuck backwards compatibility and use fish

Fish might be good for interactivity, but in terms of scripting, just go straight to python. It's not worth it.

[–] Cysioland@lemmygrad.ml 3 points 1 year ago

Fish is starting to get more POSIX compliant as of late, the error redirect is no longer ^ /dev/null but 2>/dev/null

[–] AffineConnection@lemmy.world 2 points 1 year ago

[[ is not a POSIX shell feature.

[–] twelvefloatinghands@lemmy.world 8 points 1 year ago (1 children)

So many footguns. Use python in place of bash.

[–] Rooki@lemmy.world 0 points 1 year ago (4 children)

tbh i would rather use assembly than python.

[–] herr@lemmy.world 11 points 1 year ago* (last edited 1 year ago) (1 children)

Absolutely wild take, the two are used in completely different contexts

[–] Rooki@lemmy.world 0 points 1 year ago

python if you want to f*ck every developer that comes after you and the other if want to make a small script yes. Still would choose bash tbh.

[–] dylanTheDeveloper@lemmy.world 1 points 1 year ago (1 children)

Assembly is torture because it has too much math in it

[–] Rooki@lemmy.world 2 points 1 year ago

But its less math than python. You dont have to role the dice if the error message is logical or not

[–] twelvefloatinghands@lemmy.world 1 points 1 year ago (1 children)

Python has its flaws for sure (I'm getting pretty fed up with the lack of required type notation, myself), but my point here is that bash is even worse:

[–] Rooki@lemmy.world 0 points 1 year ago (1 children)

Bash is still better than python - Change my mind

[–] twelvefloatinghands@lemmy.world 1 points 1 year ago (1 children)
[–] Rooki@lemmy.world 1 points 1 year ago (1 children)

Because f*ck python lol. Its just bad

Throw me a bone here. Is there like an existing reasons it sucks or do you just hate snakes?

[–] lud@lemm.ee 1 points 1 year ago (1 children)

Wouldn't it make more sense to code in c++ or something and compile to assembly?

How much more efficient than a compiler are one really?

[–] Rooki@lemmy.world 1 points 1 year ago

Yeah even that i would do, rather to do anything in python ;D

[–] palordrolap@kbin.social 3 points 1 year ago (1 children)

Perl calls to you. Admire its beauty.

[–] seth@lemmy.world 0 points 1 year ago* (last edited 1 year ago) (1 children)

cries in hours spent trying to walk through pretty but obtuse JAPHs

[–] palordrolap@kbin.social 4 points 1 year ago

Perl's unreasonable effectiveness for creating write-only code was part of the joke.

[–] CoderKat@lemm.ee 1 points 1 year ago

Bash is so bad. I literally use it every day and have written many Bash scripts, yet I'm constantly having to search for how to do things in it because syntax is so bizarre and difficult to remember. Need to do a for loop over lines in a file? You can bet I'm googling the syntax for it. I have a general idea for what it looks like and know what to search for, but no way in hell can I write it correctly in the first few tries.

String manipulation is the absolute worst. Have fun getting to learn the unreadable syntax of most sed and awk programs (the only thing most people have memorized is find and replace). Stuff like "split a string of comma separated ints and add them up" are way harder in Bash than in Python, despite the fact I often need to do stuff like that in Bash. Well, in the terminal anyway. Sometimes I'll just use Python, but Python's weakness is executing programs and getting their output, which is nowhere near as convenient as it is in Bash.

Side note, isn't it weird that for a language where flags like --foo bar are so commonly used, there's no built in or standard tools for accessing flags?

[–] lord_ryvan@ttrpg.network 12 points 1 year ago (2 children)

What don't you like about Python?

[–] Rooki@lemmy.world 13 points 1 year ago (1 children)

The syntax, the syntax-highlighting, venv creation and usage, having to import everything even inbuild types, have fun checking what a third party library has for functions and what they need :D Async is a hecking mess, documentation is another (bad) story.

[–] tias@discuss.tchncs.de 20 points 1 year ago (1 children)

I'm sure the syntax highlighting is entirely dependent on what editor you use, and is not a property of the language itself.

[–] Rooki@lemmy.world 1 points 1 year ago

I used pycharm, vscode ( with some extensions ), text editor, notepad++, IDLE even Thonny on my raspberry PI. Still all of them was syntax highlighting or suggestion terrible. I never knew what the function of a third party or sometimes first party library wanted.

[–] PutangInaMo@sh.itjust.works 5 points 1 year ago

I'll throw a real petty one out there.. indentation.

[–] herr@lemmy.world 8 points 1 year ago (1 children)
[–] Rooki@lemmy.world 6 points 1 year ago (2 children)

You forgot your indentation and a third party docs is outdated. Now try and debug it with this error message:

Not enough value to unpack (expected 2, got 1) (not any stack trace btw) documentation was terrible. :D

[–] herr@lemmy.world 7 points 1 year ago* (last edited 1 year ago) (1 children)

Huh? The Python Stacktrace is great. What kinda fucked up library were you using that it prints the error code instead of raising an exception?!

Also don't think outdated library docs are a fault of Python 😅 In much the opposite way, I've found Python's standard library to be really great, reducing the number of random third party libraries needed. (Looking at you, JavaScript)

[–] Rooki@lemmy.world -1 points 1 year ago (2 children)

Stack trace is terrible bad. Js for the win.

the default library is still terribly documented. OF COURSE everything is stated there but after reading the bible 3 times through you still didnt understand anything third or first party libraries!.

In python you need weirdly random packages that are inbuild but you still have to import them WHY THO???? ( looking at you typings )

The funniest thing is that python does not have a switch case where i heard it the first time, i laughed and didnt took him serious but then after looking into it, A BASIC SWITCH CASE does not exist in python. LMAO

[–] herr@lemmy.world 3 points 1 year ago* (last edited 1 year ago)

Imagine getting hung up on something as trivial as a switch statement. Which is more poignant, I ask you?

switch(var){
   case 1: 
      <code>;
      break;
   case 2: 
      <code>;
      break;
   case 3: 
      <code>;
      break;
   default:
      <code>
}

or

if var == 1:
   <code>
elif var == 2:
   <code>
elif var== 3:
   <code>
else:
    <code>

The performance difference is absolutely negligible, but now you've introduced a bunch of unnecessary indentation (for no benefit) that's gonna get hard to read should you even add a little bit of additional logic, and a footgun with all the break; s.

And then in JS the syntax for the case-blocks isn't even consistent with the rest of the language.

[–] malijaffri@feddit.ch 0 points 1 year ago* (last edited 1 year ago) (1 children)

I'm sorry, but when was the last time you actually used Python? Python has had a switch ... case ...-like structure called match ... case ... since v3.10:

https://www.geeksforgeeks.org/python-match-case-statement/

As for having to import standard libraries, why should every single function of every single built-in library be included in every single Python program, much less in compiled executables? At that point, it just bloats up your file sizes and RAM usage.

ETA: You are literally the only person in this whole thread that has such a huge problem with Python. What did it ever do to you?

[–] Rooki@lemmy.world 1 points 1 year ago

Because probably you all never coded something really with python.

[–] Mikurei@lemmy.ml 3 points 1 year ago* (last edited 1 year ago) (1 children)

You forgot your indentation

Sounds like a problem for someone who is writing the code on a toilet paper or whiteboard. Most people have some sort of hackable editor/IDE that handles the indentation and code blocks.

obfuscated error messages

Just don't use libraries which print or log exceptions without raising it :)

[–] Rooki@lemmy.world 0 points 1 year ago

AWS boto3, FastAPI and django. Good to know, that i shouldnt use them.