Add antipatterns repo
This commit is contained in:
1 parent
311255c312
commit
6f941a8ab3
13 files changed
+1686
No files matched your search
@@ -0,0 +1,19 @@
|
||||
from collections import namedtuple
|
||||
|
||||
Bread = namedtuple('Bread', 'color')
|
||||
|
||||
class ToastException(Exception):
|
||||
pass
|
||||
|
||||
def toast(bread):
|
||||
try:
|
||||
put_in_toaster(bread)
|
||||
except:
|
||||
raise ToastException('Could not toast bread')
|
||||
|
||||
|
||||
def put_in_toaster(bread):
|
||||
brad.color = 'light_brown' # Note the typo
|
||||
|
||||
|
||||
toast(Bread('yellow'))
|
||||
Reference in new issue
Block a user