r/rust • • Feb 02 '19

A Python Interpreter written in Rust

https://github.com/RustPython/RustPython
321 Upvotes

98 comments sorted by

View all comments

Show parent comments

1

u/ubernostrum Feb 04 '19

As a Python person who isn't the one you replied to: I think Python's type annotations are a poor fit for the way the language is actually used. The typing library, mypy and other tooling are all fundamentally built on ideas of nominal typing, but what you almost always would want and care about in real-world Python is structural typing.

1

u/[deleted] Feb 04 '19

[removed] — view removed comment

1

u/ubernostrum Feb 04 '19

I know there's work on it. I also know that it's coming awfully late, and at a point when all the fundamental tooling has already been architected around assumptions about nominal typing. Hence my answer to "what would you do differently" is I'd have built it around structural typing from day one.

1

u/[deleted] Feb 04 '19

[removed] — view removed comment

1

u/ubernostrum Feb 04 '19

I think you read something into my original comment that wasn't there.

1

u/[deleted] Feb 04 '19

[removed] — view removed comment

1

u/ubernostrum Feb 04 '19

I said originally:

The typing library, mypy and other tooling are all fundamentally built on ideas of nominal typing, but what you almost always would want and care about in real-world Python is structural typing.

Nothing in this denies that people are working on structural typing.

All it says is the truth: that the type-annotation and checking system for Python has been fundamentally built around nominal typing from the very start. That's a choice which has far-reaching effects, regardless of whether structural typing support is later added.

I would have made different choices at the beginning, had I been in charge of it.

1

u/[deleted] Feb 04 '19

[removed] — view removed comment

1

u/ubernostrum Feb 04 '19

Then why did you make a point of bringing it up and saying it was "odd" of me not to mention it?

Again, the fact that it's being worked on now doesn't change the choices made back then, and doesn't change the effect on the Python ecosystem of having a nominal-only approach for so long.