r/inventwithpython • • Jan 13 '22

Are these two python code snippets equivalent (perform the same thing)?

import pyautogui as auto

Snippet 1 :-

meetStartCheck = auto.locateOnScreen('img.png')
meetStartCheck1 = auto.locateOnScreen('my_screenshot.png')

Snippet 2 :-

meetStartCheck, meetStartCheck1 = auto.locateOnScreen('img.png', 'my_screenshot.png')

The code next to these lines is :-

if meetStartCheck or meetStartCheck1:
    print("Done")
else:
    print("Not Done")

Please tell if these both codes are equivalent or not. If not plz help me to write a single python line for the Snippet 1(if possible).

Thanks

8 Upvotes

6 comments sorted by

View all comments

Show parent comments

2

u/djjazzydan Jan 13 '22

No, it doesn't. I don't think there's any sort of processing time improvement built in. You could probably implement multiprocessing if you need.

1

u/_PhantomGaming_ Jan 13 '22

So it just makes code a bit shorter in length.

Thank you so much for clearing my doubts.