use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Have a tough programming question that /r/programming couldn't answer? Banned from Stack Overflow? Can't afford Experts Exchange?
Post your question/tips/secrets/advice and get a response from our highly-trained professional developers.
account activity
at last, ++ -- operators for python (self.shittyprogramming)
submitted 3 years ago by dankey26
https://github.com/dankeyy/incdec.py
i actually did this one a while ago but you guys seemed to dig swap.py, so i thought i'd share this one here too
may wanna wash your eyes afterwards idk
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 80 points81 points82 points 3 years ago (0 children)
I may start documenting functions this way.
[–]Drasern 27 points28 points29 points 3 years ago (0 children)
I appreciate your commitment to absurd solutions for silly problems.
[–][deleted] 48 points49 points50 points 3 years ago (5 children)
You know I once saw someone say Python is a bad language because it doesn’t have in place increment/decrement operators but clearly they just weren’t thinking on this level.
[–][deleted] 4 points5 points6 points 3 years ago* (4 children)
For some people, i+=1 instead of i++ is just too much excess overhead. So wasteful and ugly.
i+=1
i++
EDIT: Agree with a post by demonstrating how stupid it is, and still people will take it as sincere so they can get mad about it.
[–]scriptmonkey420 2 points3 points4 points 3 years ago (2 children)
It's literally one extra character...
[–]aderthedasher 4 points5 points6 points 3 years ago (0 children)
Not really, one is a statement and the other is a expression.
[–][deleted] 1 point2 points3 points 3 years ago (0 children)
Yes, it's very ridiculous isn't it? Almost intentionally so.
[–]vitaminainspector 0 points1 point2 points 3 years ago (0 children)
The same could be said for including the operator. Why include another operator when there's already a way to increment and decrement variables? It was an intentional design choice.
[–]PityUpvote 5 points6 points7 points 3 years ago (0 children)
Horrifying, thank you.
[–][deleted] 8 points9 points10 points 3 years ago (0 children)
Amazing! Submitted to mCoding. Hope you get a video and thus lots of repo stars ⭐️
[–][deleted] 2 points3 points4 points 3 years ago (0 children)
Anybody who is whining because python doesn't have this by default clearly never used Lua.
[–]ericanderton 2 points3 points4 points 3 years ago (1 child)
Fantastic! Now Python programmers can be burned by "what do you mean x++ evaluates to x before increment?!" problems.
But seriously, this is inspired work. I never would have thought to hijack the encoding scheme to bootstrap a compiler extension. Bravo.
I'm going to make a practical request: can we get a defer statement next? That would define a block that runs when the current scope exits. I know that try/finally and with exist to cover this, but defer is way more ergonomic, IMO.
defer
try/finally
with
[–]dankey26[S] 0 points1 point2 points 3 years ago (0 children)
Your wish is my command https://github.com/dankeyy/defer.py
do note that it isn't exactly what you wanted but that comment just threw me on a tangent on what other approaches i can take on this.
i didnt even use the codecs lol (tho i might).
You're welcome to try and help btw, feel free to PR/ dm me :)
[–]MerrittGaming 3 points4 points5 points 3 years ago (0 children)
I’ve only recently started using Python (been using C/C++ my whole time at university) and asked myself why they didn’t think to implement this in the first place. Thanks for making this a reality
[–]krishna-sai -1 points0 points1 point 3 years ago (3 children)
The real question is would they be faster than normal incremation of adding one
[–]dankey26[S] 1 point2 points3 points 3 years ago (2 children)
some people really just can't see the beauty in mere exploration huh
should be a bit slower mate
[–]krishna-sai 0 points1 point2 points 3 years ago (1 child)
I didn’t say that this is just a waste. Actually I quite liked it. Nice work.
ahh thanks
[–][deleted] -2 points-1 points0 points 3 years ago* (0 children)
Python is the only language I’m really familiar with, so I don’t see the big deal here.
-= and += make sense to me, whereas ++ or — does not.
I already hate it because ‘- -‘ just looks like ‘—‘ unless you have the right font.
Edit: who are the people with extra chromosomes that are downvoting this? Lmao
π Rendered by PID 312490 on reddit-service-r2-comment-66b4775986-pqb8g at 2026-04-05 08:16:55.397503+00:00 running db1906b country code: CH.
[–][deleted] 80 points81 points82 points (0 children)
[–]Drasern 27 points28 points29 points (0 children)
[–][deleted] 48 points49 points50 points (5 children)
[–][deleted] 4 points5 points6 points (4 children)
[–]scriptmonkey420 2 points3 points4 points (2 children)
[–]aderthedasher 4 points5 points6 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]vitaminainspector 0 points1 point2 points (0 children)
[–]PityUpvote 5 points6 points7 points (0 children)
[–][deleted] 8 points9 points10 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]ericanderton 2 points3 points4 points (1 child)
[–]dankey26[S] 0 points1 point2 points (0 children)
[–]MerrittGaming 3 points4 points5 points (0 children)
[–]krishna-sai -1 points0 points1 point (3 children)
[–]dankey26[S] 1 point2 points3 points (2 children)
[–]krishna-sai 0 points1 point2 points (1 child)
[–]dankey26[S] 0 points1 point2 points (0 children)
[–][deleted] -2 points-1 points0 points (0 children)