if not isinstance()
时间: 2023-11-16 07:05:07 浏览: 59
`isinstance()` is a built-in Python function that returns a boolean value indicating whether an object is an instance of a specified class or of a subclass thereof. The syntax of the `isinstance()` function is as follows:
```
isinstance(object, classinfo)
```
Here, `object` is the object being tested and `classinfo` is either a class object or a tuple of class objects. If `object` is an instance of `classinfo`, or of a subclass thereof, the function returns `True`; otherwise, it returns `False`.
The `not` keyword is a logical operator in Python that negates the boolean value of a statement. Therefore, `not isinstance(object, classinfo)` would return `True` if `object` is not an instance of `classinfo`, or of a subclass thereof.