Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I don't think you know how assembler works if you think that a,b=b,a is any better than doing it step-by-step or with a function :P
-
Me to python devs: can you even join an enterprise and make scalable modular applications bro
-
@sharktits wait, what? Who says you can't create an "enterprise" grade scalable application using python? (Unless you're talking about not releasing the source code, then I agree)
-
@HelloUglyWorld this idiom in Python is specifically optimised in the bytecode to push the two values onto the stack, rotate them, and pop them again. I’m pretty sure that’s faster than using a function or three variables.
-
@IllSlapU yes it’s unpacking values from the right side tuple and assign them to the variables on the left side 😉 it is 🐍
-
Fairly sure C# has this now! Woop woop!
@rhubarbcode Wouldn't the fastest solution be to use the XCHG instruction (on Intel) though? Which I would be surprised if the C++ swap didn't do. -
@sharktits No it doesn't!
There are many many successful projects running python in production (if not having their whole production code in python). Anyways, at the end of the day don't just use one tool for everything.. -
aether627yVHDL
Assuming a and b are registers, in a process you can write:
a<=b;
b<=a;
Takes a single clock to perform. Behold the power of concurrency!
Me to non python devs
Can you even a,b=b,a bro? 😎
rant