Skip to content Skip to sidebar Skip to footer
Showing posts with the label Python Typing

Weird Mro Result When Inheriting Directly From Typing.namedtuple

I am confused why FooBar.__mro__ doesn't show like the above two. I still don't know why a… Read more Weird Mro Result When Inheriting Directly From Typing.namedtuple

Is There A Way To Pass An Array To A Python Generic?

I am doing some meta programming, and I need a way to define type hints on the fly. Is there a way … Read more Is There A Way To Pass An Array To A Python Generic?

How Can I Add Python Type Annotations To The Flask Global Context G?

I have a decorator which adds a user onto the flask global context g: class User: def __init__(… Read more How Can I Add Python Type Annotations To The Flask Global Context G?

Type-hinting Parameters With A Sentinel Value As The Default

I currently use this strategy when I cannot assign default arguments in a function's signature … Read more Type-hinting Parameters With A Sentinel Value As The Default

How Do I Avoid Type Errors When Internal Function Returns 'union' That Could Be 'none'?

I've been running into a bit of weirdness with Unions (and Optionals, of course) in Python - na… Read more How Do I Avoid Type Errors When Internal Function Returns 'union' That Could Be 'none'?