Finite State Machine

Results 43 comments of Finite State Machine

One possible approach to determining if a value is likely `Hashable`: in the entire system being type-checked, is there any known example of the specified type that is _not_ `Hashable`?...

This provides a very useful workaround to the lack of support for arbitrary class decorators; a metaclass and `__get__()` could accomplish almost anything a decorator could.

Accessible version of the first code block in this issue's description: ```python3 # with '@property' used as a function: class SomeClass: def _get_foo(self) -> int: return 42 foo = property(get_foo)...

> You're using property in a very unusual manner here. Agreed. I was hoping to work around #6700 as follows: ```python class SomeClass: ... some_prop = property(getter, setter) some_alias =...

@tyralla and @TeamSpen210: thank you _so_ much for your work on this! While I'm reasonably handy when it comes to using mypy, I have very little knowledge of its internals;...

Sorry I've been quiet on this; I've had a nasty bug for the past 10 days or so. Is there anything I can do to help this along?

I suspect I've re-discovered this bug again, with the following [code](https://mypy-play.net/?mypy=master&python=3.12&flags=new-type-inference&gist=bebbace64ace0cb9b004e7daa04a868f): ```python from __future__ import annotations from typing import ( Sequence, Tuple, Union, ) class Class1: pass class Class2: pass...

@tyralla I was thinking "rediscovered" as in "this is a special case of #17099". If it's not, and it doesn't make sense to tack the extra work onto this PR,...

**Further context** This might help explain how this problem arises: Gists: [mypy-play.net](https://mypy-play.net/?mypy=latest&python=3.12&flags=strict%2Cwarn-unreachable&gist=7dc45018bd705be996635566fad36b1c) [pyright-play.net](https://pyright-play.net/?strict=true&code=GYJw9gtgBA%2BjwFcAuCQFM5QJYQA5hCSgEMA7UsJYpLMUgZwChRIokBPXLUgc2zwJEAFIyhjxYsADc0IADZhiAEwA0oieIAyWJLOJy1G8QBVOaAGrEQho1ADiaUrKwBjG0dO407jQHlcNHT6PhIAqqS0pCHiAJTM4NAcXLwwaAAeugyR9Pz4hFAitlAAcmgy1upGAMpocsDRYnGMAEq%2BUAC8UNq6IPoA2gDkrQMAui0A6h1dOnpyg83jo4yMAGIw4FOeFlZCA2vgAypQrUcLMeIAxFDAcsQ8AFzYOUgAFlg5AwCyd64AImj0FwgAZQdDKAC0dDk7AA-MtGC5bvQct8eH8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JosnrdJC3SeRO2wCDc60EfU2jg684pygCBOELQOQGD0OCkPN20h93QlAlmO99sOPAAkiAAiABBZeoHatgRS%2BGWMVH0Hx7gLV99fg%2BJAbnJuBcSBcGoNcNxsDMGScKAwADcV035FDjmIb2Qk-Zkk-M0ceLUBjHy6hHToYto5QI0FcIQh5mKI3oC8MACA5BKFIAMIgrxZDUi7NSMgkDcF4Mpn0BApAwT12IOuNAIwQRynQDCJoGsVrZxeLrPk7MCAtw0ijG2ncpgDythLW2IApYOyviwl2Ip3aCgITkOBvsd6kkwVAbBpcBrqIrjnKurha7gQbhEFwzcjaAw7knc2PdkTWwkMosmdsWQPzBkISemiZ46LdiAD2a9DGb3gSY8OkdVRAA) (seems less broken, but it's complaining about `__init__()` having an unknown return type when `@overload`ed) ```python from...

I do realize `NoReturn` is intended to represent `sys.exit()` and the like, but it should (in my understanding) signal to mypy that a callable with that return type will raise...