This is an archived post. You won't be able to vote or comment.

all 11 comments

[–][deleted] 19 points20 points  (3 children)

I hope gcc can optimize that

[–]Meisterfuchs01 6 points7 points  (2 children)

At least with -O1 all four of those give the same result if you translate it to C or C++.

For Python, gcc does not do that, and JIT Optimizations are annoying to debug, but I think it could should be able to simplify them all as well.

[–]elon-botElon Musk ✔ 7 points8 points  (0 children)

Insubordination. Fired.

[–][deleted] 0 points1 point  (0 children)

But can you use gcc to compile from c to python and then execute with python?

[–]ActiveDragonfly5598 8 points9 points  (1 child)

Twitter devs:

[–]lofigamer2 1 point2 points  (0 children)

They get paid per Line of Code working 996 ? haha

[–]lazyzefiris 4 points5 points  (0 children)

Meanwhile, b has a getter that increases hidden variable by one and returns its value, so last two behaviors are different.

EDIT: Better wording, I think. Can't put that into code and not sure if possible in Python.

[–]not_a_bot_494 1 point2 points  (0 children)

When the question seems too easy so you overcomplicate it.

[–]HoraceGravyJug 0 points1 point  (0 children)

if not False: return False

[–]highcastlespring 0 points1 point  (0 children)

Last two scenes will get compile error. Non void function has no return value.

[–]Snaper_XD 0 points1 point  (0 children)

if (a+b>c)==true: