2 ms·
You can manually pass in the `self` parameter to unbound methods if you like. import itertools class Test(): def __init__( self, number ):
by knome 12y ago
You can manually pass in the `self` parameter to unbound methods if you like.
import itertools
class Test():
def __init__( self, number ):
self._number = number
return
def aaa( self ):
print 'AAA<%s>' % str( self._number )
return
def bbb( self ):
print 'BBB<%s>' % str( self._number )
def main():
instances = [ Test( n ) for n in range( 100 ) ]
functions = [ Test.aaa, Test.bbb ]
for instance, function in zip( instances, itertools.cycle( functions ) ):
function( instance )
if __name__ == '__main__':
main()