Redefining built-in 'set'
11
12
13@app.route('/set/<pin:int>/<state:int>')
14def set(pin, state):15 if pin not in pins:
16 abort(code=404, text="pin useless")
17 if not state in (1, 0):
Description
Defining a local variable or function with the same name as a built-in object makes the built-in object unusable within the current scope and makes the code prone to bugs.
Bad practice
dict = {} # dict is a Python builtin!
for idx, student in enumerate(students):
dict[student] = idx
Preferred:
roll_number = {}
for idx, student in enumerate(students):
roll_number[student] = idx