Error: Segmentation fault (core dumped)

“Segmentation fault (core dumped)” is the string that Linux prints when a program exits with a SIGSEGV signal and you have core creation enabled. This means some program has crashed. If you’re actually getting this error from running Python, this means the Python interpreter has crashed. There are only a few reasons this can happen: … Read more

Class constants in python

In python, I want a class to have some “constants” (practically, variables) which will be common in all subclasses. Is there a way to do it with friendly syntax? Right now I use: and I’m wondering if there is a better way to do it or a way to do it without then having to … Read more

What is a ‘NoneType’ object?

NoneType is the type for the None object, which is an object that indicates no value. None is the return value of functions that “don’t return anything”. It is also a common default return value for functions that search for something and may or may not find it; for example, it’s returned by re.search when the regex doesn’t match, or dict.get when the key has … Read more

What does “hashable” mean in Pytho

From the Python glossary: An object is hashable if it has a hash value which never changes during its lifetime (it needs a __hash__() method), and can be compared to other objects (it needs an __eq__() or __cmp__() method). Hashable objects which compare equal must have the same hash value. Hashability makes an object usable as a dictionary key and a set … Read more

super(type, obj): obj must be an instance or subtype of type

You should call super using the UrlManager class as first argument not the URL model. super cannot called be with an unrelated class/type: From the docs, super(type[, object-or-type]): Return a proxy object that delegates method calls to a parent or sibling class of type. So you cannot do: You should do: Or in Python 3: