futures = [multiply_by_two(number) , multiply_by_three(number)]
results = [future.result() for future in futures] - Pehle ek function call hoga aur uska result aane tak wait karega.
- Jab pehla complete ho jaye, tabhi doosra function chalega.
- Matlab step-by-step chalega, ek ke baad doosra (synchronous execution).
- Dono functions ek saath call ho jate hain, magar abhi result nahi liya jata.
- Jab result chahiye hoga, toh dono ka result ek saath future se le lenge.
- Parallel execution hoti hai, jo tez hoti hai (asynchronous execution).
Yani pehle future list mein store karne se dono functions ik saath call hote hain, aur jab result chahiye hota hai, tabhi hum wait karte hain. 🔄🚀