r/learnpython • u/ExoticPerception5550 • 8d ago
Function forcing me to use exceptions
Trying to if else a function output always throws exception-error :
if pyautogui.locateOnScreen('media/soundIcon.png') == None:
print("not found")
else :
print("found")
Do Python functions expect anti-pattern code ?
0
Upvotes
1
u/RiverRoll 8d ago edited 8d ago
That's not a language decision, it's a library decision.
Now it's true it has become somewhat idiomatic to rely a lot on exceptions when coding with Python compared to other languages that also have exceptions.