เมื่อเขียนโปรแกรมใน python การใช้ Idiomatic python นั้นเป็นเรื่องปกติ หนึ่งในสำนวนของ python คือ EAFP:ง่ายกว่าที่จะขอการให้อภัยมากกว่าการอนุญาต ลองสร้างไดเร็กทอรี หากมีอยู่ คุณจะได้รับข้อผิดพลาดที่ตรวจพบได้
ตัวอย่าง
import os, errno
try:
os.makedirs('my_folder')
except OSError as e:
# If error is not already exists, then raise the error else continue
if e.errno != errno.EEXIST:
raise
# Now do what you want with my_folder