Day 9: Pythons Safe Words – dont use Keywords and Built-ins!

Python has a number of Keywords that you are not allowed to use as class, function or variable names.

and

as

assert

break

class

continue

def

del

elif

else

except

exec

finally

for

from

global

if

import

in

is

lambda

while

with

yield

print

raise

return

try

Python has also a variety of build-in-functions like print() and object(). While you are not allowed to use keywords
in any other context, you can name a variable or a function „print“ or „object“ without getting an error. But you really
shouldn’t do this since your own object will override or shadow the build-in-function – at least name wise.

If you write a function „def print(x):“ it will work just fine as long as you don’t want to use the buld-in print-method.

So it is really not recommended to use any of these build-ins

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.