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

Class Generic

object --+
Known Subclasses:

Abstract base class for generic types.

A generic type is typically declared by inheriting from an instantiation of this class with one or more type variables. For example, a generic mapping type might be defined as:

 class Mapping(Generic[KT, VT]):
     def __getitem__(self, key: KT) -> VT:
     # Etc.

This class can then be used as follows:

 def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
         return mapping[key]
     except KeyError:
         return default
Nested Classes [hide private]
Metaclass for generic types.
The most base type
Instance Methods [hide private]
    Inherited from object
x.__delattr__('name') <==> del
default object formatter
x.__getattribute__('name') <==>
x.__init__(...) initializes x; see help(type(x)) for signature
helper for pickle
helper for pickle
x.__setattr__('name', value) <==> = value
size of object in memory, in bytes
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)
Class Variables [hide private]
  __abstractmethods__ = frozenset([])
  __args__ = None
  __extra__ = None
  __origin__ = None
  __parameters__ = ()
  _abc_cache = <_weakrefset.WeakSet object at 0x7f0f27072a90>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x7f0f270...
  _abc_negative_cache_version = 20
  _abc_registry = <_weakrefset.WeakSet object at 0x7f0f27072a50>
Properties [hide private]
    Inherited from object
the object's class
Method Details [hide private]

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

Returns: a new object with type S, a subtype of T
Overrides: object.__new__
(inherited documentation)

Class Variable Details [hide private]


<_weakrefset.WeakSet object at 0x7f0f27072ad0>