Python Method Redefinition#
Did you know that you can redefine a method on the same class in Python?
class Foo:
def x(self):
print('a')
def x(self):
print('b')
foo = Foo()
foo.x()
What do you expect to happen?
If you want to try this at home (for your copy & paste convenience):
cat <<'EOF' > /tmp/foo.py
class Foo:
def x(self):
print('a')
def x(self):
print('b')
foo = Foo()
foo.x()
EOF
python /tmp/foo.py
pip install mypy
mypy /tmp/foo.py
PostgreSQL
Python Project Setup