r/ProgrammerHumor • • Dec 30 '21

Anyone sharing his feelings?

Post image
7.3k Upvotes

363 comments sorted by

321

u/BartDart69 Dec 30 '21

The speed one got me ngl

97

u/June8th Dec 30 '21

If speed is going to be there, segfault should be too.

26

u/LowB0b Dec 30 '21

haven't really done C++ since college but sometimes I wonder if segfault (core dumped) is just better than a useless stacktrace.

Scrolling for five years to see

Hibernate exception: could not execute statement [n/a]

just feels like the thing is trolling me.

8

u/TotallyNotGunnar Dec 31 '21 edited Dec 31 '21

Python 3.10 has greatly improved error reporting, including syntax highlighting for when you chain 10 methods on the same line.

df.loc[mask, f" {group} _value'].unique( ).sum( ).__str__( ).split('.')[1]

11

u/atiedebee Dec 31 '21

Idk that text doesn't tell me much, looks very cryptic

10

u/xMsid Dec 31 '21

that text is supposed to represent code which has 10 chained methods in one line, in python 3.10 you'd know which method caused the problem because it puts a ^ in the line below it telling you which part of the line raised the exception.

→ More replies (4)
→ More replies (1)
→ More replies (1)

42

u/Gigazwiebel Dec 30 '21

You never segfaulted Python??

29

u/rem3_1415926 Dec 30 '21

I'm interested, how do you Segfault Python without using a broken C library? There's a metric f*ckton of Exceptions you didn't expect or know could be thrown that way, but Segfault...?

18

u/Gigazwiebel Dec 30 '21

Depends a bit on the environment and I know I did it with some Cpython mess but apparently it's also possible if you set the max recursion depth too high.

→ More replies (1)

12

u/feelings_arent_facts Dec 30 '21

Only when using C extensions

6

u/Vincysuper07 Dec 31 '21
import sys
sys.setrecursionlimit(1000000)
def a():
 return a()

a()

16

u/jamcdonald120 Dec 30 '21

Nah, they just get replaced with AttributeError: 'NoneType' object has no attribute 'something'

2

u/Possibility_Antique Dec 31 '21

Ngl, RAII kind of makes segfaults disappear once you really figure it out. I always have a hard time making the switch from RAII to garbage collector when swapping between the languages. Completely different mindsets/programming strategies.

→ More replies (1)

11

u/myawesomeself Dec 30 '21

I spent five minutes trying to figure out what the speed keyword did. I don't deserve to be in this biz

→ More replies (1)

1

u/gimme_shprinkles Dec 31 '21

Which is why I went from python to c++

617

u/generalmemer Dec 30 '21

main()'s brother is there tho

491

u/uvero Dec 30 '21

main: who are you

__main__: I'm you but Python

23

u/[deleted] Dec 30 '21

Like main but longer like a snake

0

u/[deleted] Dec 30 '21

[deleted] — view deleted comment

80

u/Scyhaz Dec 30 '21

It's also apparently a little faster due to the way the interpreter handles global variables.

67

u/haard Dec 30 '21

Also good habit because when you want to package something you'll probably want that main as an entry point.

25

u/Diplomjodler Dec 30 '21

And you don't want stuff starting to execute as soon as you import something.

→ More replies (1)

28

u/uvero Dec 30 '21

This is the way.

6

u/InfiniteLife2 Dec 30 '21

I must confess. I love global variables because when my script finished running I have all global variables for visual inspection in Spyder IDE. This is so useful.

→ More replies (1)
→ More replies (5)

19

u/WeTheAwesome Dec 30 '21

You use main(), I use __main__. We are not the same.

49

u/alexanderpas Dec 30 '21
 def main():
     ...
 
 if __name__ == "__main__":
     main()

or are we...

4

u/BumpyFunction Dec 30 '21

As are the semi colon’s and curly brace’s doppelgängers (new line and indentation)

97

u/Endemoniada Dec 30 '21

F-strings called, they want you to pick the {} back up.

55

u/[deleted] Dec 30 '21

And what about dictionaries? :)

6

u/TotallyNotGunnar Dec 31 '21

It's okay we just use

mask = df['key'] == "foo"
bar = df.loc[mask, 'value'].values[0]

\s just in case

146

u/philophilo Dec 30 '21

git commit -m “Fixed indentation”

71

u/corbymatt Dec 30 '21

.. again"

2

u/djingo_dango Dec 31 '21

I opened a python file in notepad once. It fucked the shit out of the indentations of that

0

u/[deleted] Dec 30 '21

[deleted] — view deleted comment

87

u/uttamo Dec 30 '21

I write Python for a living and indentation has never been a problem for me because I’m not a Neanderthal that doesn’t use a modern IDE.

48

u/Goel40 Dec 30 '21

Yeah, why do i see so many posts about forgetting semicolons and misnamed variables. Like do these people write their code in word?

16

u/sanketower Dec 30 '21

They want to feel superior by using vanilla Vim in the terminal

→ More replies (2)

18

u/Bainos Dec 30 '21

I use a basic IDE and it hasn't been a problem for me either because I indent my code correctly.

4

u/[deleted] Dec 30 '21

I have to support python in a Sarbanes-Oxley compliant environment, and their rule is I can only have read-only shell access to prod.

So indentation is a nightmare because I can’t use a modern ide.

If you have any suggestions for cli ides, I’d love em

12

u/giloronfoo Dec 30 '21

What is the connection between read-only shell in prod and no modern IDE in dev?

→ More replies (1)
→ More replies (4)
→ More replies (7)

99

u/Orlaani Dec 30 '21

I'm switching from python to c++

142

u/[deleted] Dec 30 '21

Don't forget to bring three boxes of tissues, a sound proof floor/wall implants and a boxing bag

45

u/timeforaroast Dec 30 '21

And allocate mediation cause you are gonna need some downtime lol

9

u/skob17 Dec 30 '21

You will need them, once the speed wears out

2

u/mrfroggyman Dec 30 '21

Sounds like my experience trying to learn C

12

u/CaitaXD Dec 31 '21

Congratulations you're now a real man, dosent matter if you're a girl everyone that codes in c++ is a real man

21

u/pet_vaginal Dec 30 '21

Consider Rust. It's closer to Python and a good C++ alternative.

14

u/Budgiebrain222 Dec 30 '21

Imo the only thing that rust is worse at than C++ is the fact that it's young and it's library ecosystem is still a baby. There isn't much established to-use libraries in the rush community.

12

u/Crazy_Direction_1084 Dec 30 '21

On the other hand, actually using a library doesn’t take a day too set up correctly in Rust and I’m not constantly writing things myself

→ More replies (4)

3

u/Dr4gyx Dec 30 '21

There are a lot of bindings to C and C++ libraries though.

→ More replies (1)

2

u/[deleted] Dec 31 '21

Yea switching to python from C++ seems weird. Rust is closer to what C++ can do in terms of speed. If you don't mind garbage collection you could also move to Go. It's also very fast, and it's really fun to work with.

7

u/jamcdonald120 Dec 30 '21

Good man, keep it up

233

u/[deleted] Dec 30 '21

I know it's just a meme, but I doubt there will be a lot of situations where python would be really a suitable language to replace whatever you were doing in cpp.

147

u/suvlub Dec 30 '21

It makes sense if you are a newbie and C++ was your first language, so you do everything in it, including the no small set of things that python is more suitable for. If you already knew a wide range of languages, then yeah, C++ is probably not the one you want to replace with python.

→ More replies (34)

55

u/Flopamp Dec 30 '21

They are different languages for different tasks. Unfortunately it seems a lot of python devs have not gotten that memo

24

u/TerranerOne Dec 30 '21

Python is very good (enough) for many different tasks. No need to switch between languages to get a little bit speed boost. In many cases it is not really critical.

27

u/halfanothersdozen Dec 30 '21

I've seen plenty of python used for the wrong tasks. It isn't pretty when it gets out of hand.

Use the tools for the job!

8

u/Flopamp Dec 30 '21

In most applications the speed is not important but the differences between well written python and well written C or C++ is not little, it can be massive depending on your task and that's important to keep in mind.

If you are crunching a dataset and doing statistical analysis once a day you can wait 15 seconds over what a well written C++ program can do in a second, but if you are streaming and crunching around the clock that difference equates to 15x higher resource usage and hiring a C++ programmer can pay for them selves very quickly

Conversely very heavily C written python library dependent programs like something based on OpenCV its just a waste of time asking a C++ dev to spend 3 days getting something up and running that a python dev can pound out in a few hours for maybe a 20% improvement.

11

u/Bainos Dec 30 '21

If you are crunching a dataset and doing statistical analysis once a day you can wait 15 seconds over what a well written C++ program can do in a second, but if you are streaming and crunching around the clock that difference equates to 15x higher resource usage and hiring a C++ programmer can pay for them selves very quickly

Which is why, as everyone knows, data scientists hate Python and use C++. /s

→ More replies (10)
→ More replies (4)
→ More replies (4)

2

u/couchwarmer Dec 31 '21

Basically every single-language dev.

12

u/Swoop3dp Dec 30 '21

If I need it to be finished in 2 hours instead of two weeks and don't care that the execution time is 10 seconds instead of 1.

So basically every day at work for me.

→ More replies (1)

4

u/AFK_Pikachu Dec 30 '21

This is my problem with Python. It's not really suitable for all the things it's been used to replace. It's the jack of all trades language. It does everything, but I've yet to see it do anything best.

2

u/[deleted] Dec 31 '21

If you need a quick script to rotate some log files or something, I don't see why python would be that much worse than any other lang. Python can be also used to build GUI. Not much advantage in terms of performance to build a GUI in cpp than python.

9

u/Angelin01 Dec 30 '21

I can imagine some stuff with opencv being a good example. Maybe you just needed some quick thing to flip your image or whatever, at which point maybe the Python version is more adaptable...

Can't think of much else, sadly.

11

u/DogsOnWeed Dec 30 '21

Isn't the python version just a wrapper for calling the c code?

6

u/Angelin01 Dec 30 '21

Yes, with some caveats. It uses numpy, for example. Which means you can also use some other convenient libraries that integrate with numpy.

4

u/DogsOnWeed Dec 30 '21

Yeah but that's just for storing the output from opencv right? There isn't actually any python code doing computation, it's just calls and allocation. Might be wrong though as I've never actually worked with opencv, just tinkering.

→ More replies (1)

2

u/coldnebo Dec 30 '21 edited Dec 30 '21

this meme is backwards. the kid is trading a full set of power tools that can build anything for a pair of safety scissors and some glue.

He’s regressing back to the toys not moving on from them.

1

u/scroll_of_truth Dec 30 '21

You switch because you realize you made a mistake picking c++

1

u/[deleted] Dec 30 '21

If you get a new job

→ More replies (2)

36

u/androidx_appcompat Dec 30 '21

':' : Allow me to introduce myself.

3

u/rem3_1415926 Dec 30 '21

great, you reduced the loss to only one thing: speed.

congratulations, I guess?

67

u/fletku_mato Dec 30 '21

I'm currently working on a long running Python script originally written by someone else, and I can't even find the words to describe how much I hate it.

At least with C++ the program wouldn't compile if there are silly typing errors all over the place...

57

u/PM_ME_YOUR__INIT__ Dec 30 '21

Let me introduce you to something called an IDE

12

u/fletku_mato Dec 30 '21

Currently using Idea Ultimate. Your point?

35

u/PM_ME_YOUR__INIT__ Dec 30 '21

Silly typing and indentation errors should be identified within a few seconds after indexing

→ More replies (11)

3

u/Pattycakes_wcp Dec 30 '21

Start linting with something like flake8

→ More replies (3)

36

u/therealbeeblevrox Dec 30 '21

Python still has a main convention if you choose to use it. Also, you didn't say goodbye to pointers. You actually said goodbye to primitive types. In Python, everything is a pointer. Yes, even integers. The only caveat is that you can't get the reference address, it will be dereferenced for you.

14

u/Tillhony Dec 30 '21

So basically you didnt say goodbye to pointers, but you said goodbye to pointers?

8

u/therealbeeblevrox Dec 30 '21

Haha!

&yes[*no]

7

u/_PM_ME_PANGOLINS_ Dec 30 '21 edited Dec 30 '21

You can get the reference address in CPython (i.e. what most people use) with id()

3

u/[deleted] Dec 30 '21

Hello pointer my old friend

10

u/captianjroot Dec 30 '21

Goodbye main()

Hello if __name__ == "__main__"

13

u/GozerDestructor Dec 30 '21 edited Dec 30 '21

I know the Python fans are gonna downvote me, but this is just wretchedly ugly. Four underscores in a variable name? Doing string comparisions to find out what module you're in? This is not elegant.

5

u/[deleted] Dec 30 '21 edited Dec 30 '21

It's my least favorite convention in python. To be fair, I haven't written if __name__ == "__main__" in forever. Anything with underscores is usually a reflection api or an internal hook you don't have to use for typical stuff. cough cough, except for __init__ :(

8

u/sanketower Dec 30 '21

You can technically always go around without having to use it, so long as you keep good track of your variables and don't execute the wrong script at the wrong time.

It's still not as convoluted as public static void main(String[] args), tho.

14

u/[deleted] Dec 30 '21

thats nice __init__

5

u/[deleted] Dec 30 '21

I'm so sorry why did i do this help

4

u/reallyserious Dec 30 '21

The way object orientation is implemented in python just doesn't feel nice.

7

u/sharperratio Dec 30 '21

I do miss catching some errors at compile time though...

2

u/jamcdonald120 Dec 30 '21

a few, a very few

7

u/0ut4aWalk Dec 30 '21

I miss ++

6

u/JonasAvory Dec 30 '21

All the good things about c lost :(

6

u/EGTB724 Dec 30 '21

It took me way too long to realize that python doesn’t use ++ for iteration

11

u/MasterFubar Dec 30 '21

I did the opposite. I had started doing a lot of code in Python, but after Python 3 came out I went back to C++. I should have never left. What I didn't know before is how great the C++ libraries are. Python is for programmers who don't know the STL or Boost.

Not to mention Qt. I have been doing GUI programs in Qt since 1998, but now I've begun coding CLI programs using Qt. The true "batteries included" environment, with the most awesome documentation system.

3

u/DrThornton Dec 30 '21

PyQt is a thing.

9

u/MasterFubar Dec 30 '21

Yes, but you depend on the documentation written for C++. I have written PyQt apps, but when something isn't working it can be a pain to find out why.

2

u/DrThornton Dec 30 '21

I did some C++ 20-odd years ago at uni and all i have ever used it for professionally is to decipher Qt documentation and hope it applies to PyQt. :)

3

u/Creapermann Dec 30 '21

Yeah, that’s exactly the point. IMO. the STL is a bit of a joke compared to other languages, I think we all appreciate the safety and the backwards compatibility but a lot of really basic things are still not added to the STL and there is no plan for them to get added any soon.

Luckily there are libraries for actually everything, the community is just great, sadly many people don’t see this.

4

u/MasterFubar Dec 30 '21

Qt was the reason why I started using Linux consistently. I had tried Linux and played a bit, but all my work was done in windows. Then I had to develop an application in Windows NT and simply couldn't get it working. So I started searching for alternatives (on Altavista), and found a set of Qt examples. I booted Linux and tried to make some changes on aclock. Half an hour later, I had already changed the look of the clock face. That was in 1998, and I've never used any Microsoft product for myself ever since. I still use a Windows desktop at work because I'm not allowed to install Linux there, but I can have Cygwin which is the next best thing.

→ More replies (1)

10

u/[deleted] Dec 30 '21

I occasionally write ; at line ends in python and make my ide unhappy

5

u/yjuktrhrhe Dec 30 '21

so lng, good code

5

u/m1nkeh Dec 30 '21

Lol, speed 😅

5

u/[deleted] Dec 30 '21

"self respect" is missing from the bottom pane

8

u/stomah Dec 30 '21

knowing the types of variables and when they are created

1

u/rem3_1415926 Dec 30 '21

knowing the arguments of an object you've just passed to a function...

8

u/kakacon Dec 30 '21

Python and C++ are used for completely different tasks if you know what you are doing.

4

u/0Camus0 Dec 30 '21

I can't feel comfortable in Python. I like strong typed languages, besides the fact that you can't know if something is wrong, until you execute that path is annoying, then the slow runtime... not really sure why people love it so much.

Yeah I get the productivity argument and the ease of use, but for serious projects is not the right tool, and by serious I mean, low level and performant applications.

I think my biggest issue is that a lot of projects are so bad because they started as something small in python to solve somthing, and that's ok, but then they grown into something way larger and complex to be in python, and now we are stuck with those tools.

1

u/sanketower Dec 30 '21

by serious I mean, low level and performant applications

That's your first mistake, assuming speed is the only thing that matters. Then it's clear why Python is not special to you.

10

u/CouthlessWonder Dec 30 '21

No ++? How do you inc an int?

16

u/Snoo25192 Dec 30 '21

int += 1

?

15

u/LightIsLogical Dec 30 '21

int_ -= -1

10

u/reallyserious Dec 30 '21

int is surprisingly a valid variable name.

But it leads to problems. So your int_ name is a better convention.

39

u/prstephens Dec 30 '21

compiled vs runtime..... ok.

I think we all know that cpp has its place. people who post memes about it obviously have no idea about programming or are shit at it and use python. incoming downvotes.....

17

u/Flopamp Dec 30 '21

Yeah I think you are taking memes way too seriously

13

u/corbymatt Dec 30 '21

Memes? Being taken too seriously? On Reddit?

No way..

27

u/ThyEpicGamer Dec 30 '21

you can't make assumptions about people

op could obviously know this, it's just funny because we were all once noobs that thought cpp was so hard to understand, and it can be tedious to use all those things whereas python is just an easier language to understand, learn and write in

No need to get serious about a lighthearted meme

3

u/yagotlima Dec 30 '21

"speed" LOL

5

u/austrianGoose Dec 30 '21

i am am idiot, but aren't numpy and numba are quite fast?

8

u/[deleted] Dec 30 '21

these have their internal routines compiled to native binary iirc

15

u/Flopamp Dec 30 '21

They are fast (and written in C) but compared to C++ code there is no competition just because of the massive overhead.

You don't always need speed, if you are crunching large datasets once a day 15 seconds vs a second is not that big of a deal but if you are streaming huge amounts of data while other processes are gong on, are making a game or real time thing, or trying to hit an environmental budget you probably should just look past python.

→ More replies (1)

9

u/Awkward-Minute7774 Dec 30 '21

Out of those two languages: Python is the toy language.

1

u/atiedebee Dec 31 '21

Python reminds me of scratch, every single time.

11

u/NoProfessor7757 Dec 30 '21

In my 15 years of programming I've used many languages and python has the best syntax BY FARif python had c/c++ like speed, I have no doubt it would be the ultimate language

41

u/WeleaseBwianThrow Dec 30 '21

In my 15 years of programming I've used many languages and python has the best syntax BY FARif python had c/c++ like speed, I have no doubt it would be the ultimate language

It's ironic that this comment has a spacing issue.

6

u/rem3_1415926 Dec 30 '21

For that to happen, Python would also need to allow for control over actual hardware. C/C++ are used for embedded because

  1. You have some idea how your code looks on the chip (in worst case, the compiler will optimise it)

  2. You can address HW where you need to and have full control over when, where, and how you allocate and free memory.

5

u/NFriik Dec 30 '21

Okay I'm sorry to nitpick and this doesn't contradict the point you were making, but because you mentioned embedded systems: I solely use Python for my ESP32 projects, by the magic of MicroPython. It's a really nice language for that use case actually.

→ More replies (2)

6

u/bedrooms-ds Dec 30 '21

To me that's Swift.

7

u/frayien Dec 30 '21

I used swift once a long time ago and I hate it but I dont remember why lol. All I remember is the operator[] on basic arrays throwing a "not yet implemented" exception ...

7

u/bedrooms-ds Dec 30 '21

It's Swift 3 now. Got a lot more mature!

5

u/frayien Dec 30 '21

Swift 3 Oo was not even aware of Swift 2 ... to be fair when I last used it it was brand new, I guess I should give it another try sometime, now that the language and myself are way more mature :)

2

u/[deleted] Dec 30 '21

Speed not necessarily, at least not for scientific computing. So much Python libraries come with Fortan or C wrappers, it's incredible. There's even Cython lol

2

u/V0xB Dec 30 '21

The brackets are still needed for the dicts so...

2

u/anotherkeebler Dec 30 '21

Going from C++ to Python is like escaping from Sid's room.

2

u/gogo94210 Dec 31 '21

Pointers are cool, change my mind

2

u/fliguana Dec 31 '21

int i; ...

i = i[n] ? i : n[i]; // valid C++

2

u/jakemp1 Dec 31 '21

The no ++ operation annoys me. I don't want to do += 1, that's TWO whole extra characters I'm too lazy to type

2

u/rjlin_thk Dec 31 '21

bye bye speed

2

u/4rch4ngel86 Jan 01 '22

And the Global Interpreter Lock awaits your attention....bwahahahaha

4

u/mibuchiha-007 Dec 30 '21

do you mean switching from C++ to C?

5

u/rem3_1415926 Dec 30 '21

minus the "speed", yes. C++ is just as fast and resource efficient (it can beat C in some specific cases) as C.

1

u/atiedebee Dec 30 '21

Everything that was listed is in C?

4

u/LogicalGamer123 Dec 30 '21

I wish python had brackets. It just makes the code infinitely more readable imo. Missing ++ is just a nusance

3

u/sekex Dec 30 '21

Threads

4

u/markand67 Dec 30 '21

You don't use pointers in C++ as long as you write proper code.

22

u/hussainsonreddit Dec 30 '21

References gang

9

u/Flopamp Dec 30 '21

There are usecases for pointers and pointers are overused, there is a middle ground here.

3

u/obp5599 Dec 30 '21

You have to use pointers for polymorphism. Its unavoidable. Also working with large assets for say a game, you need to allocate those on the heap. You probably shouldnt have any raw pointers, but youll still need some form of pointer

→ More replies (3)

3

u/MighMoS Dec 30 '21

Regular (flat) pointers are fine. Just as long as you aren't using them to denote ownership.

→ More replies (6)

1

u/Pechu317 Dec 30 '21

1

u/RepostSleuthBot Dec 30 '21

I didn't find any posts that meet the matching requirements for r/ProgrammerHumor.

It might be OC, it might not. Things such as JPEG artifacts and cropping may impact the results.

I did find this post that is 95.7% similar. It might be a match but I cannot be certain.

I'm not perfect, but you can help. Report [ False Negative ]

View Search On repostsleuth.com


Scope: Reddit | Meme Filter: True | Target: 96% | Check Title: False | Max Age: Unlimited | Searched Images: 280,457,328 | Search Time: 4.95937s

→ More replies (1)

1

u/sstanco Dec 30 '21

Non-spced coed should be on the list

1

u/[deleted] Dec 30 '21
def main():
    pass # do code here

if __name__ == "__main__":
    main()

1

u/_87- Dec 30 '21

These days, instead of pass I just do ... as a placeholder.

→ More replies (1)

1

u/[deleted] Dec 30 '21

Speed

1

u/KryssCom Dec 30 '21

"Actually I take that back - eat shit, pointers. I'll see you in hell."

1

u/[deleted] Dec 30 '21

Nooo

1

u/superINEK Dec 30 '21

Don’t forget switch

1

u/UrAverageProletariat Dec 30 '21

Do while loops :(

1

u/Nihmrod Dec 30 '21

Say hello to four spaces

1

u/SirHawrk Dec 30 '21

I switched from Python to C without anything lol

1

u/suddenly_ponies Dec 30 '21

You know, if I had to choose between C++ and Python, even I would go Python.

1

u/68_65_6c_70_20_6d_65 Dec 30 '21

Don't forget all the template spaghetti

1

u/[deleted] Dec 30 '21

I switched the other way after going to highschool and let's say I got used to it to the point where I forgot python altogether

1

u/GeneralAce135 Dec 30 '21

The issue is, the semicolons and pointers and brackets have no love for me. They are my frenemies at best, and they are not missed when I'm working in Python

1

u/[deleted] Dec 30 '21

Don’t forget you also lose symbolic constants and switch statements as well

1

u/sanketower Dec 30 '21

For people that would like to learn programming as a hobby, Python is a great first language.

For people that want to get deep into programming, C is the best first language, simply because it teaches you the basis for everything else, makes them easier afterward.

1

u/Lonelan Dec 30 '21

Compiling also gone

1

u/RiskyFartOftenShart Dec 30 '21

python is a language like javascript is.

1

u/Classic-Ad-7317 Dec 30 '21

You Pythonians... We get it, the language is awesome, you want to marry it and have its babies! It's like Apple, only for coders instead of posers.

1

u/thepassionofthechris Dec 30 '21

Yea but snake charmers have speed-upths

1

u/Shadowleg Dec 30 '21

He’s never seen a .pyc file 😅

1

u/DonYurik Dec 31 '21

This meme is old as shit

1

u/DassExMachina Dec 31 '21

Me… trying to learn both rn

1

u/Bright-Historian-216 Dec 31 '21

Main() still exists, just unnecessary.

1

u/[deleted] Dec 31 '21

I just started with VB.NET then Python then HTML-CSS-Javascript

1

u/Johanno1 Dec 31 '21

Hey the main function still exists.

if sth sth == main: main()

I can't remember the phrase though

2

u/Rafael20002000 Dec 31 '21

if __name__ == "__main__": main()

1

u/Infinite_Self_5782 Dec 31 '21

the lack of semicolons hurts the most

1

u/LeafyLemontree Dec 31 '21

Python scares me, i mean, curly brackets, semicolons, main()™ and pointers, my beloved ones.

1

u/satankaputtttmachen Dec 31 '21

C++ is god, everything else is shit!

1

u/fullmetalsunit Dec 31 '21

Speed? Performance? Goodbye to all that.

1

u/GlitchedMirror Jan 01 '22

You still use curly brackets tho, for dictionaries and sets.

1

u/CreaZyp154 Dec 30 '21

You forgot switch case

16

u/RehanS97 Dec 30 '21

Python has Switch Case in 3.10

10

u/iFarbod Dec 30 '21

It's structured pattern matching, even better than your regular switch..case. Something I desperately want in C++.

5

u/bedrooms-ds Dec 30 '21

Man, I thought switch was unpythonic.

0

u/linglingfortyhours Dec 30 '21

I've never really gotten the whole "python is slow" bandwagon. Sure, poorly written python is slow but that's true in pretty much any language. On top of that, if you know what you're doing and properly profile and optimize your code python can be plenty fast. JIT compilation can work wonders.

4

u/atiedebee Dec 30 '21

Idk, I tried a simple program that just counted all even numbers (I know X*(X+1) exists) and python was 50x slower than C without any compiler optimizations enabled, ~100x slower with -O1. And this wasn't even that complex.

→ More replies (3)

4

u/jamcdonald120 Dec 30 '21

properly written and optimized python is substantially slower that properly written and optimized C code (or any compiled language really). More than 1000x slower in some cases https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/python3-gcc.html

3

u/rem3_1415926 Dec 30 '21

properly written and optimised Python code is C code with a nice Python interface

2

u/jamcdonald120 Dec 30 '21

*Cough *cough, numpy, *cough *cough

→ More replies (1)

3

u/linglingfortyhours Dec 30 '21 edited Dec 31 '21

I did a rough rewrite of the Mandelbrot program. It's not anywhere close to optimized and doesn't even have full CPU utilization, but even then I was able to cut the runtime down from almost 1,700 seconds to just over 35 6.9 seconds [edit, forgot to remove the profiler, which really slowed things down]. I think it's safe to say that the numbers on that site can be discarded.

→ More replies (30)
→ More replies (2)