Well... quite a lot of things about that code aggravate me; most of them could be solved by making it pep8 compliant.
The main things are trying to one-line functions even when they are excessively long.
Also, you should be using docstrings for documentation, not #comments.
#comments should be used for inline comments, or to explain specifically convoluted things that occur in the middle of a function.
For a primary example of things that annoy me take this function:
Even more so, I think you will find that this does the same thing:
The main things are trying to one-line functions even when they are excessively long.
Also, you should be using docstrings for documentation, not #comments.
#comments should be used for inline comments, or to explain specifically convoluted things that occur in the middle of a function.
For a primary example of things that annoy me take this function:
def isnum(x): return True if 'bit_length' in dir(x) else True if 'is_integer' in dir(x) else True if 'radix' in dir(x) else FalseThis is onelined just for the sake of it and is using multiple ternaries to do so.
Even more so, I think you will find that this does the same thing:
from numbers import Number #... isinstance(thing, Number)In fact it looks like almost all of those functions in that block could be handled with isinstance. There is no need to check the dir of an object to tell if it is a dict or not (unless you are worried about subclasses of dict being positives in which case your method won't work either).
>>> a = [] >>> b = {} >>> isinstance(a, dict) False >>> isinstance(b, dict) True >>>