Special type indicating an unconstrained type. - Any is compatible with every type. - Any assumed to have all methods. - All values assumed to be instances of Any. Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should
| 586 | |
| 587 | |
| 588 | class Any(metaclass=_AnyMeta): |
| 589 | """Special type indicating an unconstrained type. |
| 590 | |
| 591 | - Any is compatible with every type. |
| 592 | - Any assumed to have all methods. |
| 593 | - All values assumed to be instances of Any. |
| 594 | |
| 595 | Note that all the above statements are true from the point of view of |
| 596 | static type checkers. At runtime, Any should not be used with instance |
| 597 | checks. |
| 598 | """ |
| 599 | |
| 600 | def __new__(cls, *args, **kwargs): |
| 601 | if cls is Any: |
| 602 | raise TypeError("Any cannot be instantiated") |
| 603 | return super().__new__(cls) |
| 604 | |
| 605 | |
| 606 | @_SpecialForm |
no outgoing calls