[rfc] Make sentinel objects instances of themselves#18
Merged
Conversation
Current coverage is 100% (diff: 100%)@@ master #18 diff @@
===================================
Files 20 20
Lines 867 869 +2
Methods 0 0
Messages 0 0
Branches 169 169
===================================
+ Hits 867 869 +2
Misses 0 0
Partials 0 0
|
Member
Author
|
@Lukasa: do you happen do have any opinion on this? |
Member
|
The implementation is bonkers, but the goal is sound. Wanting to do dict-dispatch or the equivalent of singledispatch based on event type is a good idea, and if this can do that without difficulty or reduction in supported Python versions then I say why not? |
Member
Author
|
It's not entirely unprecedented: after all, Oh well, let's do it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a slightly wacky solution to #8. By "slightly wacky" I mean that contains the following line of code:
Based on watching some of his talks I feel fairly confident that @dabeaz will appreciate this, but I am less certain about whether it's actually a good idea, so would appreciate comments ;-).
Actually, my main hesitation is that I'm not really sure whether doing table-based dispatch on the return value from
next_eventever makes much sense -- in my experience so far, libraries usually have a pretty small and specific set of events that they're looking for at any given time. But maybe it's useful for those who like more declarative state-machine kind of approaches? And it's not a big deal to support; it's like 2 extra lines of code that don't touch anything else in h11 at all.This is a reworked version of @RazerM's work in #11.