Solved inconsistency in decoders inheritance hierarchy#1161
Solved inconsistency in decoders inheritance hierarchy#1161cdeler wants to merge 1 commit intoencode:masterfrom
Conversation
22e4e15 to
7ff4bd5
Compare
|
Okay, so I'm going to close this one off, since it seems like a technical bit of refactoring, in search of a problem that doesn't exist. Or to put it another way - I can't see what you're actually trying to solve here? Please don't let that put you off tho' - the contributions are appreciated either way! But let's not introduce extra hierarchy, ABCs, and other trickery unless there's a really clear end-user facing reason why we're doing so. 😀 |
|
@tomchristie , I do agree that it might look like a refactoring without a target, but I wanted to solve this problem: class DeflateDecoder(Decoder):
# ...
def __init__(self, request: "Request") -> None:
self.request = request # <-- here we do not call super type constructor, but just set the request property
self.first_attempt = True(it looks the same for Nevertheless, I accept the idea, that refactoring without a clear target is a root of evil (and just wanted to explain the cause of my PR) |
|
Yes, this rings a bell… :) #1095 (comment) |
@tomchristie,
I tried to find a common ancestor in
Decodershierarchy (just wanted to make it clearer). Unfortunately there is a big gap between e.g.TextDecoderandBrotliDecoder(approach withCallablelooks weak, but once Guido advised it python/typing#241 (comment))If I did something strange or unnecessary, feel free to decline the PR
Beware: I introduced
abchere.