Fix a typo, unfortunately propagated by word-completion.
This commit is contained in:
parent
805ab456a8
commit
d313d180ae
24
pep-0280.txt
24
pep-0280.txt
|
@ -261,7 +261,7 @@ Additional Ideas
|
||||||
class cell(object):
|
class cell(object):
|
||||||
def __init__(self, obj=NULL, builtin=0):
|
def __init__(self, obj=NULL, builtin=0):
|
||||||
self.objptr = obj
|
self.objptr = obj
|
||||||
self.buitinflag = builtin
|
self.builtinflag = builtin
|
||||||
|
|
||||||
and a celldict maps strings to this version of cells. builtinflag
|
and a celldict maps strings to this version of cells. builtinflag
|
||||||
is true when and only when objptr contains a value obtained from
|
is true when and only when objptr contains a value obtained from
|
||||||
|
@ -305,26 +305,26 @@ Additional Ideas
|
||||||
if key in self.basedict:
|
if key in self.basedict:
|
||||||
c.objptr = self.basedict[key]
|
c.objptr = self.basedict[key]
|
||||||
assert c.objptr is not NULL # else "in" lied
|
assert c.objptr is not NULL # else "in" lied
|
||||||
c.buitinflag = 1
|
c.builtinflag = 1
|
||||||
else:
|
else:
|
||||||
# There is no builtin with the same name.
|
# There is no builtin with the same name.
|
||||||
assert not c.buitinflag
|
assert not c.builtinflag
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
return [k for k, c in self.__dict.iteritems()
|
return [k for k, c in self.__dict.iteritems()
|
||||||
if c.objptr is not NULL and not c.buitinflag]
|
if c.objptr is not NULL and not c.builtinflag]
|
||||||
|
|
||||||
def items(self):
|
def items(self):
|
||||||
return [k, c.objptr for k, c in self.__dict.iteritems()
|
return [k, c.objptr for k, c in self.__dict.iteritems()
|
||||||
if c.objptr is not NULL and not c.buitinflag]
|
if c.objptr is not NULL and not c.builtinflag]
|
||||||
|
|
||||||
def values(self):
|
def values(self):
|
||||||
preturn [c.objptr for c in self.__dict.itervalues()
|
preturn [c.objptr for c in self.__dict.itervalues()
|
||||||
if c.objptr is not NULL and not c.buitinflag]
|
if c.objptr is not NULL and not c.builtinflag]
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
for c in self.__dict.values():
|
for c in self.__dict.values():
|
||||||
if not c.buitinflag:
|
if not c.builtinflag:
|
||||||
c.objptr = NULL
|
c.objptr = NULL
|
||||||
|
|
||||||
# Etc.
|
# Etc.
|
||||||
|
@ -357,14 +357,14 @@ Additional Ideas
|
||||||
def reflect_bltin_del(self, key):
|
def reflect_bltin_del(self, key):
|
||||||
c = self.__dict.get(key)
|
c = self.__dict.get(key)
|
||||||
assert c is not None # else we were already out of synch
|
assert c is not None # else we were already out of synch
|
||||||
if c.buitinflag:
|
if c.builtinflag:
|
||||||
# Put us back in synch.
|
# Put us back in synch.
|
||||||
c.objptr = NULL
|
c.objptr = NULL
|
||||||
c.buitinflag = 0
|
c.builtinflag = 0
|
||||||
# Else we're shadowing the builtin, so don't care that
|
# Else we're shadowing the builtin, so don't care that
|
||||||
# the builtin went away.
|
# the builtin went away.
|
||||||
|
|
||||||
Note that c.buitinflag protects from us erroneously deleting a
|
Note that c.builtinflag protects from us erroneously deleting a
|
||||||
module global of the same name. Adding a new (key, value) builtin
|
module global of the same name. Adding a new (key, value) builtin
|
||||||
pair is similar:
|
pair is similar:
|
||||||
|
|
||||||
|
@ -378,10 +378,10 @@ Additional Ideas
|
||||||
# but doesn't anymore; rehabilitate it.
|
# but doesn't anymore; rehabilitate it.
|
||||||
assert not c.builtinflag
|
assert not c.builtinflag
|
||||||
c.objptr = value
|
c.objptr = value
|
||||||
c.buitinflag = 1
|
c.builtinflag = 1
|
||||||
else:
|
else:
|
||||||
# We're shadowing it already.
|
# We're shadowing it already.
|
||||||
assert not c.buitinflag
|
assert not c.builtinflag
|
||||||
|
|
||||||
Changing the value of an existing builtin can be viewed as deleting
|
Changing the value of an existing builtin can be viewed as deleting
|
||||||
the name, then adding it again. Indeed, since mutating builtins is
|
the name, then adding it again. Indeed, since mutating builtins is
|
||||||
|
|
Loading…
Reference in New Issue