No reference vs referencing nothing

How do I make a variable that doesn’t reference anything?

I tried “None”, but that literally references nothing itself!

A variable always references something, even if that something is None.

Though it’s not a variable,

I hear tell of “pass” being a way to not reference anything,

What are your thoughts?

No, this is a way to not do anything.

Any name that is used, has to be used for something. That way, when you ask Python what’s there, it can actually tell you.

1 Like

pass is used when a statement is required by the syntax, for example:

try:
    # Delete a file.
    remove(path)
except FileNotFoundError:
    # The file didn't exist.
    pass

What about bypassing a name error with a try-except block?

You’ll just avoid crashing your program. The variable in the try you attempted to create will not exist.

The try-except block worked in my case…

Thank you Matthew