Package horizons :: Package ext :: Module typing :: Class _TypeAlias
[hide private]
[frames] | no frames]

Class _TypeAlias

object --+
         |
        _TypeAlias

Internal helper class for defining generic variants of concrete types.

Note that this is not a type; let's call it a pseudo-type. It can be used in instance and subclass checks, e.g. isinstance(m, Match) or issubclass(type(m), Match). However, it cannot be itself the target of an issubclass() call; e.g. issubclass(Match, C) (for some arbitrary class C) raises TypeError rather than returning False.

Instance Methods [hide private]
 
__getitem__(self, parameter)
 
__init__(self, name, type_var, impl_type, type_checker)
Initializer.
 
__instancecheck__(self, obj)
 
__repr__(self)
repr(x)
 
__subclasscheck__(self, cls)
    Inherited from object
 
__delattr__(...)
x.__delattr__('name') <==> del x.name
 
__format__(...)
default object formatter
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__hash__(x)
hash(x)
 
__reduce__(...)
helper for pickle
 
__reduce_ex__(...)
helper for pickle
 
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
int
__sizeof__()
size of object in memory, in bytes
 
__str__(x)
str(x)
 
__subclasshook__(...)
Abstract classes can override this to customize issubclass().
Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, *args, **kwds)
Constructor.
Properties [hide private]
  impl_type
  name
  type_checker
  type_var
    Inherited from object
  __class__
the object's class
Method Details [hide private]

__init__(self, name, type_var, impl_type, type_checker)
(Constructor)

 
Initializer.

Args:
    name: The name, e.g. 'Pattern'.
    type_var: The type parameter, e.g. AnyStr, or the
        specific type, e.g. str.
    impl_type: The implementation type.
    type_checker: Function that takes an impl_type instance.
        and returns a value that should be a type_var instance.

Overrides: object.__init__

__new__(cls, *args, **kwds)
Static Method

 

Constructor.

This only exists to give a better error message in case someone tries to subclass a type alias (not a good idea).

Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)