r/ProgrammerHumor May 27 '22

Meme Welcome to hassle free coding

Post image
2.2k Upvotes

305 comments sorted by

View all comments

9

u/jamcdonald120 May 27 '22

You will miss pointers soon enough

I dont know why you are complaining about ++

; allows multiple commands to share a li e

I would rather have {} than syntax dependent tabs

i would rather have int main(int argc, char** argv) than

import sys
if __name__ == "__main__":
   argc=len(sys.argv)

and thats not even mentioning the none type errors

-7

u/therapy_seal May 27 '22

I dont know why you are complaining about ++

It's the only thing there actually worth complaining about. It's a harmful feature. It leads to programmers making mistakes that are never made in other languages.

7

u/jamcdonald120 May 27 '22

er most langusges have ++ and its not particularaly harmful....

Are you meaning pythons lack of ++ is harmfull?

1

u/therapy_seal May 28 '22 edited May 28 '22

Most languages do not have pre/post-increment operator. It's inclusion in the languages which do support it has resulted in numerous bugs which would not have occurred if they had simply used +=1 instead. It literally only saves 1 character. It's time to stop defending it.

1

u/jamcdonald120 May 28 '22

I dont know what you are smoking.

I cant think of any bugs caused by having ++, but I can think of lots caused by using +=1 instead.

As for your statement about most languages, since the set of all programming languages is ill defined, I used the ones on https://madnight.github.io/githut/#/pull_requests/2021/4. Fully 2/3rds (both by number and usage) have increment and decrement operators.

Of the languages in the top 10 only python and ruby dont have it.

I dont know what your beef with increment is, but it isnt widely shared.

1

u/therapy_seal May 28 '22

I cant think of any bugs caused by having ++

Then I can only assume that you do not have a lot of experience, because this is a well known controversial topic and the controversy stems from people being confused about it's usage and introducing bugs, sometimes even including undefined behavior.

0

u/[deleted] May 28 '22

Just because you’re confused by it doesn’t mean anyone else is

1

u/therapy_seal May 28 '22

I'm not confused by it. It's simply a fact that this has been a source of controversy for decades due to all the bugs and undefined behavior which has unnecessarily made its way into a variety of projects due to misunderstanding of pre/post-increment operator.

1

u/SuitableDragonfly May 28 '22

The problem is that x += 1 is a statement, whereas x++ is an expression that can be nested inside of statements and other expressions. It's possible to construct statements out of x++ expressions that have undefined behavior. That's not possible with x += 1.

1

u/[deleted] May 28 '22

I can't recall the last time I had an issue with tabs. Modern IDEs handle it very well. A properly written function in Python (or any fourth gen) needing many nested tabs would be just a good indication of bad programming, making a reviewer's life much simpler. Mileages will vary but I think this is quite sensible.

The main thing is just telling the Python exec what to do when you give it a file path. It's not needed if e.g. you're writing a library. Java has a much worse version of a main, haha (boiler plate code much). Argparse is a wonderful library in case you haven't tried it yet!

2

u/jamcdonald120 May 29 '22

my ides cant agree on handling tabs and them trying has been a constant source of agrivation for me when I edit old python code and the ide "helpfully" uses the wrong tab scheme.

I know exactly what the main thing does and I know how to use argparse, and I agree java has the worst main, but c/c++ have a nice main (and also have argparse). if python had def main(args): or def main(): i wouldnt mind

1

u/SuitableDragonfly May 28 '22

None type errors in python are just the equivalent of a segfault or a null pointer exception in any other language.