immutables icon indicating copy to clipboard operation
immutables copied to clipboard

Map type arguments aren't introspectible in runtime

Open Tinche opened this issue 2 years ago • 0 comments

Currently I don't see a way of getting the key and value types from a map type. Ideally, the Map.__class_getitem__ should return an object with __origin__ set to Map and __args__ set to a tuple of the key and value types, so that typing.get_origin() and typing.get_args() work with it.

Without this information, libraries like cattrs have no way of correctly serializing and deserializing Map instances.

Tinche avatar May 04 '22 14:05 Tinche