[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.15,1.16

Guido van Rossum gvanrossum@users.sourceforge.net
2001年8月17日 04:56:00 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv953
Modified Files:
	test_descr.py 
Log Message:
Add early binding of methods to the 2nd metaclass example.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** test_descr.py	2001年08月17日 11:43:17	1.15
--- test_descr.py	2001年08月17日 11:55:58	1.16
***************
*** 405,409 ****
 def __call__(self):
 it = _instance()
! # XXX Should do more, but that doesn't work yet
 return it
 class C:
--- 405,413 ----
 def __call__(self):
 it = _instance()
! # Early binding of methods
! for key in self.dict:
! if key.startswith("__"):
! continue
! setattr(it, key, self.dict[key].__get__(it, self))
 return it
 class C:
***************
*** 415,418 ****
--- 419,423 ----
 verify('spam' in C.dict)
 c = C()
+ verify(c.spam() == 42)
 
 def pymods():

AltStyle によって変換されたページ (->オリジナル) /