# -*- coding: utf-8 -*- """ Null object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Simple implementation of the Null Object Pattern. Taken from "Implementing the Null Object Pattern" recipe from the Python CookBook. :url: https://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch05s24.html :credit: Dinu C. Gherman :copyright: Copyright (c) 2012-2015 Scott Bahling, SUSE Linux GmbH :license: GPL-2.0, see COPYING for details """ class Null: """ Null objects always and reliably "do nothing." """ def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return self def __repr__(self): return "Null( )" def __str__(self): return "" def __nonzero__(self): return 0 def __getattr__(self, name): return self def __setattr__(self, name, value): return self def __delattr__(self, name): return self