| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
There is a sentinel in hashlib.py to detect usage of arguments and raise appropriate warnings/errors so could you also update it? it's a hacky code because I needed to mirror the C behavior in some sense.
Sorry, something went wrong.
There was a problem hiding this comment.
In dataclasses, there is also _FIELD, _FIELD_CLASSVAR and _FIELD_INITVAR that you could update I think?
Sorry, something went wrong.
|
I was going to leave those dataclasses objects alone since they're instances of a common class, and I wouldn't be able to preserve that behavior. |
Sorry, something went wrong.
|
base64._NOT_SPECIFIED is also a candidate (I don't know why, but it's currently a list of one string) |
Sorry, something went wrong.
Documentation build overview71 files changed · ± 70 modified · - 1 deleted ± Modified
- Deleted |
Sorry, something went wrong.
There was a problem hiding this comment.
I think that using names like "<not specified>", "<omitted>", etc for sentinels shown in function signatures will more clearly show that the behavior when the argument is not specified differs from the behavior when the argument is specified with any value.
Currently, for functions implemented in Argument Clinic it is shown as <unrepresentable>, but <not specified> would be better in most cases.
Sorry, something went wrong.
There was a problem hiding this comment.
No need to use sentinel() for sentinels not visible to users.
Sorry, something went wrong.
| raise KeyError | ||
|
|
||
| __marker = object() | ||
| __marker = sentinel("__marker", repr="<marker>") |
There was a problem hiding this comment.
Would not it be better to stick to some standard representation like <not specified> for sentinels only exposed in function signatures?
pop(self, key, default=<not specified>)
And why do we need a name for private sentinels? They are not supposed to be pickleable.
Sorry, something went wrong.
|
|
||
|
|
||
| UNNAMED_SECTION = _UnnamedSection() | ||
| UNNAMED_SECTION = sentinel("UNNAMED_SECTION", repr="<UNNAMED_SECTION>") |
There was a problem hiding this comment.
UNNAMED_SECTION is in the public API, it should not have obscure repr.
Sorry, something went wrong.
There was a problem hiding this comment.
What would you prefer?
Sorry, something went wrong.
| ################################################################################ | ||
|
|
||
| _NOT_FOUND = object() | ||
| _NOT_FOUND = sentinel("_NOT_FOUND", repr="<not found>") |
There was a problem hiding this comment.
It is not visible to user. It can remain object().
Sorry, something went wrong.
There was a problem hiding this comment.
I think it's still cleaner to use sentinel. Also, users inspecting the cache for debugging purposes can see this object.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.