Update of /cvsroot/pywin32/pywin32/com/win32com/client
In directory sc8-pr-cvs1:/tmp/cvs-serv30458
Modified Files:
genpy.py
Log Message:
Add __iter__ support for objects with enumerators
Index: genpy.py
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** genpy.py 26 Jul 2003 00:52:14 -0000 1.33
--- genpy.py 23 Oct 2003 07:19:15 -0000 1.34
***************
*** 24,28 ****
error = "makepy.error"
! makepy_version = "0.4.6" # Written to generated file.
GEN_FULL="full"
--- 24,28 ----
error = "makepy.error"
! makepy_version = "0.4.7" # Written to generated file.
GEN_FULL="full"
***************
*** 484,487 ****
--- 484,494 ----
if resultCLSID == "None" and self.mapFuncs.has_key("Item"):
resultCLSID = self.mapFuncs["Item"].GetResultCLSIDStr()
+ # "Native" Python iterator support
+ print '\tdef __iter__(self):'
+ print '\t\t"Return a Python iterator for this object"'
+ print '\t\tob = self._oleobj_.InvokeTypes(%d,LCID,%d,(13, 10),())' % (pythoncom.DISPID_NEWENUM, enumEntry.desc[4])
+ print '\t\treturn win32com.client.util.Iterator(ob)'
+ # And 'old style' iterator support - magically used to simulate iterators
+ # before Python grew them
print '\tdef _NewEnum(self):'
print '\t\t"Create an enumerator from this object"'
|