8 ms·
class A: def __init__(): pass def f(self): pass def g(a: A | None): a.f() (edit: I don't know how to format code on HN) If I activate type
by lairv 2y ago
class A:
def __init__():
pass
def f(self):
pass
def g(a: A | None):
a.f()
(edit: I don't know how to format code on HN)
If I activate type-checking in VS Code this will highlight an error, although the python interpreter will indeed try to run it without compile time error
As I said, for my side projects this is enough for me to model my problems properly without having to resort to multiple hacks
And I took Python as an example, I also enjoy using Ocaml and Rust
- steveklabnik 2y ago> I don't know how to format code on HN two spaces: https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc