What does instance () do in Python assignments?

var = Instance (object)?

+3
source share
2 answers

He calls the method __call__().

+4
source

Actually, I thought it was from the standard library. When viewed, this is from enthought.traits.api.Instance. It contains a link to an instance of the object. If you pass a specific class to a constructor (for example, an instance of (MyClass)), it does a check to make sure you pass the correct class.

0
source

Source: https://habr.com/ru/post/1760915/


All Articles