pyfrc icon indicating copy to clipboard operation
pyfrc copied to clipboard

PhysicsEngine should be a Protocol for type checking

Open auscompgeek opened this issue 2 years ago • 3 comments
trafficstars

https://github.com/robotpy/pyfrc/blob/9959bff71165ea74d1df018c1fb496bcb2aeafe8/pyfrc/physics/core.py#L50

https://docs.python.org/3/library/typing.html#typing.Protocol

auscompgeek avatar Dec 28 '22 14:12 auscompgeek

Says it was added in 3.8. Is it in future?

TheTripleV avatar Dec 28 '22 22:12 TheTripleV

In the past I've just done something like this:

try:
    from typing import Protocol
except ImportError:
    Protocol = object

virtuald avatar Dec 28 '22 23:12 virtuald

It should also be in typing_extensions.

auscompgeek avatar Dec 29 '22 01:12 auscompgeek