in/ antipattern pervasive in code.
Sorry for all the bug reports, but since I was here...
There's an awful lot of code that looks like this:
# Actual example: if data_type in self.yaml_multi_representers: node = self.yaml_multi_representers[data_type](self, data) if key in dictionary: process(dictionary[key])
This is a known anti-pattern in Python, because you incur the cost of the lookup in the hash table twice. The get method is very useful for this - so do consider the following alternatives.
# If you know that None is never a valid dictionary entry. value = dictionary.get(key) if value is not None: process(value) # If the dictionary might contain None. NONE = object() # NONE can be a global to avoid constructing new objects each time. value = dictionary.get(key, NONE) if value is not NONE: process(value)