-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Description
Should we identify GroupedMetadata via an __iter_analyzed_types__ method or something like that instead of a base class?
I think it's a really useful concept, but I fear that it won't be implemented for as much as it could be, for practical reasons:
- Name collision with
__iter__. - Adding a dependency on
annotated-types. - Introduces a class into the other library's class hierarchy, making it maybe impossible in some scenarios (funky things being done with classes, or extension modules).
The first one may be the biggest issue, but it's also got an easy solution: name the method something other than __iter__. But if we're doing that, might as well name it __iter_analyzed_types__ and not require the base class, which also solves the other issues.
We can make this backward compatible by making GroupedMetadata.__iter_analyzed_types__ an alias for GroupedMetadata.__iter__ and GroupedMetadata itself a Protocol. And put a deprecation warning in the latter.
@Zac-HD @samuelcolvin thoughts?
Metadata
Metadata
Assignees
Labels
No labels