Give an error if a class extends two classes
This code is accepted, even though it should generate an error:
class A: pass
class B: pass
class C(A, B): pass
@njsmith I think mypy's behavior is constrained, though I could be wrong.
Are you thinking about this for any arbitrary python module or only ones with numeric data structures and algorithms?
I would love to be able to run compiled python on the web when web assembly compilation is more mature. Do you think that is a pipe dream?
PEP 484 types clearly aren't optimal for compilers, but reinterpreting them as something closer to Cython types should be possible. For example, if something is annotated as int, the compiled code could only accept int values (and subclasses) and it could directly access the internals of the objects and store the integer value in an internal, more efficient representation. Other changes to Python/PEP 484 semantics would likely be helpful for significant performance gains -- again Cython is an interesting precedent. This wouldn't be a Python compiler any more but a Python variant, but a Cython-like approach would make it possible to run together with regular Python code in the same runtime.
Fixed-width integer types is one big thing missing from PEP 484 but it should be possible to provide type aliases such as Int32 (that PEP 484 compliant implementations would just treat these as aliases for int) that would result in fixed-width integers in compiled code.
There are a ton of details that I'm leaving out and I'm not suggesting that this would be easy (or necessarily even possible) but I think it might be feasible if we don't insist on 100% compatibility with Python semantics. Performance would likely be worse than Cython for a lot of stuff, but I think that's okay if it would still be significantly faster than CPython for an interesting set of programs.
I haven't thought about web assembly much -- can't really help there, sorry.
@JukkaL There was some discussion of using a Mypy with strict mode to compile to a python IR to be consumed by JIT compilers.
It seems there were some reservations about mypy semantics etc
If you are interested, the notes are here: https://docs.google.com/document/d/1jGksgI96LdYQODa9Fca7EttFEGQfNODphVmbCX0DD1k/edit#heading=h.v4f52j6z2px6
and mpyp was mentioned here in the gitter: https://gitter.im/python-compilers-workshop/chat
I personally would rather not wanted to see further fragmentation in the community by standardizing on something besides type hints (also cython doesn't have generics).
Please move this discussion to a new issue with a more appropriate subject. This issue has been closed since 2013 and it keeps receiving new comments that are not related to the subject. Please stop that!
(Also, there isn't any mention of mypy in the doc you linked and I found only one mention in the gitter -- if you want us to pay attention please summarize what you want from the mypy project. Finally, if this is about PEP 484, please use the tracker at https://github.com/python/typing/
Agreed that isn't the best place for this discussion. (But thanks for the links -- unfortunately I couldn't make it to the workshop.)