Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
cahva10138yI have actually moved away from using ++ and use foo += 1 in JS. But ofcourse in js theres a valid reason not to use them:
http://eslint.org/docs/rules/... -
@tahnik Really? I think it's pretty intuitive! But then again I come from a Java background...
-
flag020318yWas going to say this. No && no ++ no --. I love python but this is my biggest gripe about it
-
NonNull478yI don't like ++, it encourages to do things like "array[i++]" or "array[++i]" which often make code harder to read quickly and can be the source of bugs.
-
@Lisanna and how does && not make since if your not a c programmer? Especially since & is read as "and" in regular english.
And how is ++ "not pythonic"? I assume you mean it's out of place in that it's "out of spirit" can you give an example where +1 is "more pythonic" than the alternative of having a unary operator? -
flag020318yHonestly I don't care how they justify it being there or not. ++Ing an var is easier to type out than +=1 and i am used to it from other languages. I use python for most of my personal projects still I sometime type out var++ and have to return to fix it.
-
@Lisanna you realize your fighting against ++, on an app, where the community literally voted for the developer change +1/-1 to ++/--?
-
And I'm just here sitting and enjoying the argument I started **evil laugh** 😈
-
@Lisanna after++ is useful for any language where you want to increment a number and immediately use that number. ++before is useful when you want to use a number and afterwards immediately increment it. This is language agnostic. Yes in python looping, you don't need these operands for loop control. However, if you've ever had var+=1 followed by a usage of var, anywhere in python, there's an argument for var++. If you've ever used a var and then done var+=1: you have an argument for ++var.
Including a unary operator doesn't magically transform a loosely typed language (like python) to a very strictly typed language (like c++). Not having however, increases the learning gap in both directions when some learns python as a first language they get no experience in unary operators, and when coming from other languages with them they say "python, wtf where is your ++/-- operands??" -
NonNull478y@brettmoan you've got it reversed: i++ means use then increment, ++i means increment then use. That was exactly my point when talking about off by one errors and pointer bugs :P. It makes the code harder to read.
-
NonNull478y@chasb96 The compiler will optimize those instructions to the same assembly in most cases I think.
Related Rants
The lack of ++. Seriously, what the hell?
undefined
wk30
++
python