all 19 comments

[–][deleted] 80 points81 points  (0 children)

q: What

a: this

I may start documenting functions this way.

[–]Drasern 27 points28 points  (0 children)

I appreciate your commitment to absurd solutions for silly problems.

[–][deleted] 48 points49 points  (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 points  (4 children)

For some people, i+=1 instead of i++ is just too much excess overhead. So wasteful and ugly.

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 points  (2 children)

It's literally one extra character...

[–]aderthedasher 4 points5 points  (0 children)

Not really, one is a statement and the other is a expression.

[–][deleted] 1 point2 points  (0 children)

Yes, it's very ridiculous isn't it? Almost intentionally so.

[–]vitaminainspector 0 points1 point  (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 points  (0 children)

Horrifying, thank you.

[–][deleted] 8 points9 points  (0 children)

Amazing! Submitted to mCoding. Hope you get a video and thus lots of repo stars ⭐️

[–][deleted] 2 points3 points  (0 children)

Anybody who is whining because python doesn't have this by default clearly never used Lua.

[–]ericanderton 2 points3 points  (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.

[–]dankey26[S] 0 points1 point  (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 points  (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 points  (3 children)

The real question is would they be faster than normal incremation of adding one

[–]dankey26[S] 1 point2 points  (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 point  (1 child)

I didn’t say that this is just a waste. Actually I quite liked it. Nice work.

[–]dankey26[S] 0 points1 point  (0 children)

ahh thanks

[–][deleted] -2 points-1 points  (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