[tor-bugs] #33825 [Core Tor/Chutney]: Make Environ handle "in" and "get()" like a dict
Tor Bug Tracker & Wiki
blackhole at torproject.org
Thu Apr 16 03:43:44 UTC 2020
#33825: Make Environ handle "in" and "get()" like a dict
-------------------------------------------------+-------------------------
Reporter: teor | Owner: (none)
Type: defect | Status:
| needs_revision
Priority: Medium | Milestone:
Component: Core Tor/Chutney | Version:
Severity: Normal | Resolution:
Keywords: ipv6, outreachy-ipv6, technical- | Actual Points:
debt |
Parent ID: #33050 | Points: 1
Reviewer: | Sponsor:
| Sponsor55-can
-------------------------------------------------+-------------------------
Comment (by teor):
For "in" (and "not in"), the object should define `__contains__()`, see:
https://docs.python.org/3.7/reference/expressions.html#membership-test-
operations
https://docs.python.org/3.7/reference/datamodel.html#object.__contains__
The easiest way to implement all the standard dict functions is to inherit
from the MutableMapping abstract base class:
https://docs.python.org/3.7/library/collections.abc.html
If we define these functions, all other functions are implemented by the
base class mixins:
{{{
__getitem__
__setitem__
__delitem__
__iter__
__len__
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/33825#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list