DEV Community

loading...

What is async?

delta456 profile image Swastik Baranwal ・1 min read

What is async and when and why to use it? How async of Python is different from Go one?

I am new to this so I need help!

Discussion (3)

pic
Editor guide
Collapse
tcgumus profile image
Tuna Çağlar Gümüş

Async means Asynchronous. Its mainly used with await in Python. They are there for concurrent programming not to be confused with paralel.
You are using it when you want to call/run something that you don't know when it will return an answer or even have an answer. So, with using async you can "independently" execute code. It is mainly used for service calls or URL checks.

Collapse
nestedsoftware profile image
Nested Software • Edited

The main concept is the same in Python and Go: We're doing cooperative concurrency. The objective is to improve horizontal scalability - the ability of an application to scale across more users at a time. I wrote a bit of a longer piece on this topic that you might find interesting:

Collapse
adam_cyclones profile image
Adam Crockett

All the clocks of the world tick asynchronously when placed next to each other. But all clocks synchronously tick 1 second at a time.

Async is a keyword that features in many programming languages, it generally is a marker stating that you should wait until the data arrives then for example all the clocks must strike 12 before we do anything with that data. This likely differs between languages.