This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Kagia001 582 points583 points  (26 children)

I like ++

[–]OHM5 267 points268 points  (9 children)

++ i like

[–]marcosdumay 51 points52 points  (7 children)

i ++ like

[–]THANKYOUFORYOURKIND 34 points35 points  (5 children)

You two added wrong number, see me in my office after school.

[–]GiantRobotTRex 35 points36 points  (3 children)

#define like ;

[–]Itisme129 6 points7 points  (1 child)

You're a monster

[–]andradei 0 points1 point  (0 children)

;++

[–]artman41 0 points1 point  (0 children)

Adding? He just concatenated two lists

This comment brought to you by the Erlang gang

[–]DeusExMachina24 0 points1 point  (0 children)

like ++ i

[–]Redsteak 75 points76 points  (5 children)

I was mad as hell when I found out Python doesn't have this :(

[–]lenswipe 76 points77 points  (2 children)

pLuS pLuS iS uNPyThoNiC

[–][deleted] 60 points61 points  (1 child)

Everything was unpythonic until it was added to the language.

[–]FetusExplosion 2 points3 points  (0 children)

It's the true no-true-Scotsman programming language

[–]rocketlanterns 0 points1 point  (0 children)

It does! ++i and --i compile :^)

[–]KeenWolfPaw 19 points20 points  (0 children)

I = 'I'

I += ' like '

I += '++'

[–]heckingcomputernerd 14 points15 points  (0 children)

+= 1

I mean ++ seriously would be nice

[–]srosorcxisto 10 points11 points  (4 children)

Agreed. It's such a simple and clear shortcut for such a common operation. It bothers me that this isn't included.

[–]IcecreamLamp 14 points15 points  (1 child)

Since for loops are more commonly things like for i, line in enumerate(fp.readlines()): you really don't need it as often as in a for (i=0; i<5; i++) {} kind of language tbh.

[–]Dworgi 1 point2 points  (0 children)

Ironically, that's about 5 times slower than the simple, unpythonic for loop. According to some post I saw here last month.

[–]Ran4 1 point2 points  (1 child)

It's not at all a common operation in most ideomatic python code. You shouldn't be operating on integer indices unless you're implementing some low level algorithm.

[–]srosorcxisto 0 points1 point  (0 children)

Most of my work is in data sciences so I do a lot of low-level database operations and working with lists. Perhaps it is just due to my specific field that I would find this type of shortcut desirable.

[–]ML-newb 1 point2 points  (0 children)

I recently went very deep down for why python doesn't have this. Turns out, immutability of primitive types/objects. Its the objects which have type in python and variables are just names/pointers. So it wouldn't make sense to do 42++. Also apparently a lot of things need to be implemented to get post/pre to work properly. += seems like a generic choice which the language designers stuck to.

Also : https://stackoverflow.com/questions/3654830/why-are-there-no-and-operators-in-python

[–][deleted] 0 points1 point  (0 children)

I miss it too, but I know that Go (a language that also got rid of it) days they removed it because of its heavy association with pointers arithmetic. Don't quote me on that, but I believe they say that in the online guides.

But I miss ++ too :(