quantifiedcode / python-anti-patterns

An open collection of Python anti-patterns and worst practices.
https://quantifiedcode.github.io/python-anti-patterns
Other
1.72k stars 249 forks source link

Adding the type error Python compiler will throw #128

Closed dejanbatanjac closed 4 years ago

dejanbatanjac commented 5 years ago

Recent Python compilers ( I checked Python 2.7, as well 3.6, and 3.7) will throw the specific error on explicit return other than None.

You can check this with code like this

class C:
    def __init__(self):
        return 1

ci=C() #TypeError: __init__() should return None, not 'int'