syrusakbary / promise

Ultra-performant Promise implementation in Python
MIT License
362 stars 76 forks source link

Please give more "practical" examples, #98

Open berrytsakala opened 2 years ago

berrytsakala commented 2 years ago

I can't understand what the example in the readme is trying to achieve. I saw that other users are struggling and requesting info. Can we have a practical, simple example?

e.g.

def main(*args):   sleep(3);print('after sleep')
def success(*args):   print('success', args);return 'ok'
def reject(*args):   print('fail')

print('before')
>>> what now? <<<
print('end')

I was expecting to see:

before
end

< sleeping ...>

after sleep
success ok

Thanks in advance,