Package pypat :: Package behavioral :: Module null
[hide private]
[frames] | no frames]

Source Code for Module pypat.behavioral.null

1 -class Null(object):
2 """ 3 A Null object class as part of the Null object design pattern. 4 5 - External Usage documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Behavioral-Pattern-Usage} 6 - External Null Object Pattern documentation: U{https://en.wikipedia.org/wiki/Null_Object_pattern} 7 """
8 - def __init__(self, *args, **kwargs):
9 """ 10 Do nothing. 11 """ 12 pass
13
14 - def __call__(self, *args, **kwargs):
15 """ 16 Do nothing. 17 18 @return: This object instance. 19 @rtype: Null 20 """ 21 return self
22
23 - def __getattr__(self, name):
24 """ 25 Do nothing. 26 27 @return: This object instance. 28 @rtype: Null 29 """ 30 return self
31
32 - def __setattr__(self, name, value):
33 """ 34 Do nothing. 35 36 @return: This object instance. 37 @rtype: Null 38 """ 39 return self
40
41 - def __delattr__(self, name):
42 """ 43 Do nothing. 44 45 @return: This object instance. 46 @rtype: Null 47 """ 48 return self
49
50 - def __repr__(self):
51 """ 52 Null object string representation is the empty string. 53 54 @return: An empty string. 55 @rtype: String 56 """ 57 return ''
58
59 - def __str__(self):
60 """ 61 Null object string representation is the empty string. 62 63 @return: An empty string. 64 @rtype: String 65 """ 66 return ''
67
68 - def __bool__(self):
69 """ 70 Null object evaluates to False. 71 72 @return: False. 73 @rtype: Boolean 74 """ 75 return False
76