105
Comments
  • 1
    Add Scala to the list of languages
  • 5
    According to a lot of py devs, x++ doesn't make any sense :/
  • 2
    Would you like to join the dark side? ;) we have what you are looking for...
  • 4
    I 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/...
  • 4
    I would ++ the shit out of this if I could.
  • 2
    @tahnik Really? I think it's pretty intuitive! But then again I come from a Java background...
  • 3
    @JavaRules I'm ready... take me the dark side **ominous music starts playing**
  • 2
    Was going to say this. No && no ++ no --. I love python but this is my biggest gripe about it
  • 0
    Thought c was your language there, for a moment...
  • 0
    ++ is useless if you do not write standard if loops (like in c)
  • 3
    I 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.
  • 3
    @flag0 how is `&&` better than `and`
  • 1
    @afrometal muscle memory? But I still write &&, delete it and write and.
  • 0
    @NonNull haha start to talking to C pointers
  • 0
    @afrometal I never have to remember the proper casing of '&&'.
  • 1
    @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?
  • 2
    Honestly 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.
  • 2
    @Lisanna you realize your fighting against ++, on an app, where the community literally voted for the developer change +1/-1 to ++/--?
  • 0
    And I'm just here sitting and enjoying the argument I started **evil laugh** 😈
  • 0
    @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??"
  • 0
    @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.
  • 0
    @chasb96 The compiler will optimize those instructions to the same assembly in most cases I think.
  • 0
    My popcorn is over :/
Add Comment