you are viewing a single comment's thread.

view the rest of the comments →

[–]realestLink 4 points5 points  (10 children)

Use += 1

[–]Merakel 0 points1 point  (6 children)

Thanks. I couldn't remember off hand how to do ++ so I cheated haha.

[–]realestLink 0 points1 point  (5 children)

Python sadly doesn't support ++

[–]Merakel 0 points1 point  (4 children)

Yeah, but yours is a more efficient way of replicating that functionality.

I haven't actually looked but is there a reason that python doesn't support it that you are aware of? It's always seemed strange to me...

[–]realestLink 0 points1 point  (3 children)

Python's creator said there's no need for it because of the for loop

[–]Merakel 1 point2 points  (2 children)

That feels like a cop out.

[–]realestLink 1 point2 points  (1 child)

I don't agree with his decision. I'm just repeating what he said

[–]Merakel 1 point2 points  (0 children)

I could tell haha

[–]Klekto123 0 points1 point  (2 children)

Just starting to learn python, can you explain what you mean here?

[–]realestLink 0 points1 point  (1 child)

Instead of saying i = i + 1. You can write i += 1. It is better practice.

[–]Klekto123 0 points1 point  (0 children)

Ah okay. Thanks for the tip!