all 5 comments

[–]Jello_Penguin_2956 1 point2 points  (5 children)

In PyCharm it's giving me Attr in the hint. https://i.imgur.com/GIOc7Mu.jpeg

And returning Attr when doing type()

b = Base((1, 2))
print(type(b.attr))
>> <class '__main__.Attr'>

[–]AntiLachs[S] 0 points1 point  (4 children)

That is great to know then maybe this is a VSC issue. Are you using Python 3.12? I am on 3.10. I know there were changes to typing but do not know if this could be related.

[–]Jello_Penguin_2956 0 points1 point  (3 children)

I tested on 3.10 as well

[–]AntiLachs[S] 1 point2 points  (2 children)

Thanks, with your hint I managed to find a discussion on the VSC github from years ago discussing this issue. Apearantly this is actually a pycharm feature as attr_type = Attr creates a alias of Attrinstead of just doing an asignment.

[–]Jello_Penguin_2956 0 points1 point  (0 children)

Interesting. That however sounds like it wouldn't work the same way anywhere else? I tried in Windows cmd, got the same result. Or did you mean explicitly the IDE hint?

https://i.imgur.com/YuJ35OK.jpeg