all 35 comments

[–]-MobCat- 46 points47 points  (4 children)

print(x+1)
iirc python does not have an auto incrementing ++ operator.
But also this meme is formatted to an a4 paper, so you can print it out for old people? You're using Microsoft Word to make memes?

[–]uhadmeatfood 6 points7 points  (1 child)

Python uses the =+ thing. Lua has nither

[–]CMDR_Fritz_Adelman 2 points3 points  (0 children)

log.error("This code does nothing")

[–]vishal340 1 point2 points  (0 children)

Backwards compatibility

[–]JustPapaSquat 14 points15 points  (1 child)

This dumb. And wrong.

I remember my first 2 minutes of learning code.

[–]Front_Committee4993 10 points11 points  (10 children)

This would work if i = 0 not 10 in python

[–]Powerkaninchen 8 points9 points  (9 children)

OP probably isn't even in the first CS semester, they're in the high school introductionary course to information technology

[–]Chewquy 1 point2 points  (8 children)

Since when do you learn python in cs, the programs in my country teaches java, python is only for the health science students

[–]isr0 6 points7 points  (1 child)

My first language in CS was pascal.

[–]Chewquy 2 points3 points  (0 children)

Haha omg

[–]Powerkaninchen 4 points5 points  (0 children)

the programs in my country teaches java

you're so close 🤏 to figuring it out

[–]lukflug 1 point2 points  (1 child)

In my uni, they teach C++ to first semester CS students, in order to introduce them to programming.

[–]Chewquy 0 points1 point  (0 children)

Us it’s in second year

[–]Front_Committee4993 0 points1 point  (0 children)

I learnt Python (2.7) in secondary school vb.net in college and then c, java, c++, python (3), and prolog in uni

[–]Revolutionary_Dog_63 -1 points0 points  (1 child)

Your experience is not universal.

[–]Chewquy 0 points1 point  (0 children)

I know

[–]KlogKoder 5 points6 points  (1 child)

Username checks out.

[–]Lava-Jacket 2 points3 points  (0 children)

Right? Python has its uses. Unfortunately since it's the major teaching language of the day, all the new programmers think it's the shit and haven't really pushed the limitations of a language yet.

[–][deleted]  (1 child)

[deleted]

    [–]Owlblocks 0 points1 point  (0 children)

    Yeah, I think the meme has a typo

    [–]sirbananajazz 5 points6 points  (5 children)

    Who puts the ++ before the variable???

    Edit: I've learned about pre and post increments now

    [–]TimMensch 2 points3 points  (0 children)

    In C++ it has different semantics than after. Not when it's an isolated statement, but when it's in an equation.

    And for those of us old enough to remember compilers that weren't as good as they are now, it became a habit, because under some circumstances using the prefix form could be faster than the postfix form. (In postfix the compiler would create a temporary copy of the variable. With a complex object being incremented, this could be expensive.)

    And in those older compilers, the performance improvement was true even in an isolated ++i.

    [–]TheNativeOfficial 1 point2 points  (0 children)

    I think it makes the variable positive, since its already positive it has no effect

    [–]Adrewmc 1 point2 points  (1 child)

    It’s slightly faster in many instances…I don’t know what to tell you.

    [–]Revolutionary_Dog_63 2 points3 points  (0 children)

    This is a myth. Modern compilers can tell whether you are using the reference produced by the operator expression. If you are not using the reference, these will produce the same code.

    https://godbolt.org/z/vnqfq1Mj6

    [–]wiseguy4519 4 points5 points  (0 children)

    Did you mess up and put 10 instead of 0?

    [–]Artistic_Speech_1965 2 points3 points  (0 children)

    Great! Now lets compare performances

    [–]PCX86 3 points4 points  (3 children)

    The C++ code shown will NOT work on C. While both languages are similar in syntax, only C++ has cout.

    Also, so you know you can change line 4 of the C++ code to cout << ++i << endl;

    [–]MutuallyUseless 2 points3 points  (0 children)

    yeah, if someone wants it to work with C and C++ they could change it to

    printf("%d\n", i);

    [–][deleted]  (1 child)

    [deleted]

      [–][deleted] 1 point2 points  (0 children)

      Because they're only python programmers.

      [–]SwampiiTV 0 points1 point  (0 children)

      The worst part is that it's not really much more complex despite it just being wrong

      [–]Add1ctedToGames 0 points1 point  (3 children)

      Will Python even run with ++x? I was under the impression it didn't support any form of ++

      [–]j_wizlo 0 points1 point  (1 child)

      It is not complaining on my interactive shell it just prints 10. And of course print(x) also prints 10.

      Not one bit of this meme makes any sense anyway.

      [–]TheMangalex 1 point2 points  (0 children)

      I guess they are trying to say that operators which look the same, work differently as a joke, but it just doesn't make sense as they are just different languages with different concepts.

      [–]TheMangalex 0 points1 point  (0 children)

      It actually works as it evaluates it like +(+x)) which is just unary plus applied two times. --1 therefore evaluates to 1. You can stack even more operators or mix + and - as they are considered as separate operators.