Package pypat :: Package structural :: Module flyweight :: Class FlyweightMeta
[hide private]
[frames] | no frames]

Type FlyweightMeta

source code

object --+    
         |    
      type --+
             |
            FlyweightMeta


Flyweight meta class as part of the Flyweight design pattern.

- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
- External Flyweight Pattern documentation: U{https://en.wikipedia.org/wiki/Flyweight_pattern}

Instance Methods [hide private]
 
__call__(cls, *args, **kwargs)
Override call to use objects from a pool if identical parameters are used for object creation.
source code

Inherited from type: __delattr__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __init__, __instancecheck__, __le__, __lt__, __ne__, __repr__, __setattr__, __subclasscheck__, __subclasses__, mro

Inherited from object: __format__, __reduce__, __reduce_ex__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(mcs, name, bases, attrs)
Override class construction to add 'pool' attribute to classes dict.
source code
 
_serialize(cls, *args, **kwargs)
Serialize arguments to a string representation.
source code
Properties [hide private]

Inherited from type: __abstractmethods__, __base__, __bases__, __basicsize__, __dictoffset__, __flags__, __itemsize__, __mro__, __name__, __weakrefoffset__

Inherited from object: __class__

Method Details [hide private]

__new__(mcs, name, bases, attrs)
Static Method

source code 

Override class construction to add 'pool' attribute to classes dict.

Parameters:
  • name - The name of the class.
  • bases - Base classes of the class.
  • attrs - Attributes of the class.
Returns: a new object with type S, a subtype of T
A new Class.
Overrides: object.__new__

__call__(cls, *args, **kwargs)
(Call operator)

source code 

Override call to use objects from a pool if identical parameters are used for object creation.

Parameters:
  • args - Arguments for class instantiation.
  • kwargs - Keyword arguments for class instantiation.
Returns:
A new instance of the class.
Overrides: type.__call__