passing object methods to os.path.walk ?

John Schmitt jschmitt at vmlabs.com
Wed Feb 14 01:13:14 EST 2001


I did something like this:

class foo:
	def __init__(self):
		os.path.walk( self.stuff, self.slurp, self.otherstuff )
	def slurp(self):
		#some code here

and I got a 'TypeError: too many arguments; expected 3, got 4' message from
ntpath.py line 264 which reads

	func( arg, top, names )

I fixed this by moving the slurp() function out of class foo and made it a
function outside of any class.  I don't get what's going on here.  Is there
an entry in TFM for this?

BTW, Python 2.0 on Win2000

John




More information about the Python-list mailing list