Back out last second change in the examples. `missing' should be an

empty mutable (i.e. list) since empty tuples are shared.  Thanks Just!
This commit is contained in:
Barry Warsaw 2000-12-02 15:12:35 +00:00
parent e9ae8a5694
commit 9599e69426
1 changed files with 5 additions and 5 deletions

View File

@ -202,7 +202,7 @@ Examples
if name.startswith('_'): if name.startswith('_'):
return getattr(self.__contained, name) return getattr(self.__contained, name)
# Everything else gets wrapped # Everything else gets wrapped
missing = () missing = []
which = self.__contained which = self.__contained
obj = getattr(which, name, missing) obj = getattr(which, name, missing)
if obj is missing: if obj is missing:
@ -257,7 +257,7 @@ Examples
def aq_acquire(self, name): def aq_acquire(self, name):
# Everything else gets wrapped # Everything else gets wrapped
missing = () missing = []
which = self.__contained which = self.__contained
obj = getattr(which, name, missing) obj = getattr(which, name, missing)
if obj is missing: if obj is missing:
@ -282,7 +282,7 @@ Examples
if args: if args:
return setattr(self, name, args[0]) return setattr(self, name, args[0])
obj = getattr(self, name) obj = getattr(self, name)
missing = () missing = []
of = getattr(obj, '__of__', missing) of = getattr(obj, '__of__', missing)
if of is not missing: if of is not missing:
return of(self) return of(self)
@ -410,7 +410,7 @@ Examples
class Access: class Access:
def __findattr__(self, name, *args): def __findattr__(self, name, *args):
methcache = self.__dict__.setdefault('__cache__', {}) methcache = self.__dict__.setdefault('__cache__', {})
missing = () missing = []
obj = getattr(self, name, missing) obj = getattr(self, name, missing)
# if obj is missing we better be doing a setattr for # if obj is missing we better be doing a setattr for
# the first time # the first time
@ -542,7 +542,7 @@ Examples
else: else:
op = 'get' op = 'get'
# XXX: op = 'del' currently not supported # XXX: op = 'del' currently not supported
missing = () missing = []
meth = getattr(self, hookname, missing) meth = getattr(self, hookname, missing)
if meth is missing: if meth is missing:
if op == 'set': if op == 'set':