1
class Empty:
    pass

a = Empty()
a.m = 1

the above code works well and there is no error.

a = object()
a.m = 1 # it throws AttributeError

but this code throws an exception.

AttributeError: 'object' object has no attribute 'm'

What is the difference?

I just want an empty object and add some variable to it.

How can I do that? Should I make an empty class?

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.