gh-107431: Make multiprocessing.managers.{DictProxy,ListProxy} generic#107433
gh-107431: Make multiprocessing.managers.{DictProxy,ListProxy} generic#107433gpshead merged 6 commits intopython:mainfrom
multiprocessing.managers.{DictProxy,ListProxy} generic#107433Conversation
AlexWaygood
left a comment
There was a problem hiding this comment.
Thanks, LGTM! Will wait to see if Jelle has any objections before merging.
Previous additions of __class_getitem__ methods have been treated as features, so we probably can't backport this, unfortunately.
|
Hmm... I suppose one reason for not making these subscriptable at runtime might be that these are undocumented classes that aren't included in |
|
Maybe these classes should be documented? I'm also a bit hesitant about this if these classes are undocumented. |
@gpshead, any thoughts from you on this, as a multiprocessing expert? I think there's a decent case for documenting these classes, since instances of |
vstinner
left a comment
There was a problem hiding this comment.
LGTM, but i'm not a typing expert.
In case of doubt, I prefer to not document DictProxy and ListProxy. I don't think that not documenting these types should block this enhancement.
|
@JelleZijlstra: What do you think? @gvanrossum, @carljm (typing experts): Do you want to review this typing change? |
|
@vstinner, this needs input from multiprocessing experts, not typing experts. Two typing experts have already given their input here (Jelle and myself). From a typing perspective, the change is fine. But from a multiprocessing perspective: the classes are currently undocumented and not included in |
|
@pitrou: Do you have an opinion on this change? |
|
I don't think anyone wants to claim expertise for multiprocessing no matter how much we've done work on it. This change looks good to me, I made a couple edits. |
|
I have no idea what a |
|
Thanks for making _BaseDictProxy private. |
…` generic (python#107433) Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use. `ListProxy[str]` for example. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
…` generic (python#107433) Make `multiprocessing.managers.{DictProxy,ListProxy}` generic for type annotation use. `ListProxy[str]` for example. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
This looks like a reasonable use-case for generic types.
In
typeshedthey are generic:Fixes #107431.