pep-550: Rename get -> lookup (#376)

This commit is contained in:
Yury Selivanov 2017-08-25 23:42:12 -04:00 committed by GitHub
parent 1b8728ded7
commit 977886f683
1 changed files with 3 additions and 3 deletions

View File

@ -935,7 +935,7 @@ implemented as follows (in pseudo-code)::
class ContextVar: class ContextVar:
def get(self): def lookup(self):
tstate = PyThreadState_Get() tstate = PyThreadState_Get()
ec_node = tstate.ec ec_node = tstate.ec
@ -986,14 +986,14 @@ The cache is then implemented as follows::
self.version += 1 self.version += 1
def get(self): def lookup(self):
tstate = PyThreadState_Get() tstate = PyThreadState_Get()
if (self.last_tstate_id == tstate.unique_id and if (self.last_tstate_id == tstate.unique_id and
self.last_version == self.version): self.last_version == self.version):
return self.last_value return self.last_value
value = self._get_uncached() value = self._lookup_uncached()
self.last_value = value # borrowed ref self.last_value = value # borrowed ref
self.last_tstate_id = tstate.unique_id self.last_tstate_id = tstate.unique_id