mutable default parameter problem [Prothon]

Pierre-Frédéric Caillaud peufeu at free.fr
Fri Jun 18 09:20:07 CEST 2004




> I'm new to python. To my eyes this is a pretty poor attempt to
> have static variables. I've implemented in the past a few

	static variables in python

def accumulate( x ):
	accumulate.accumulator += x
	return accumulate.accumulator

accumulate.accumulator = 0



More information about the Python-list mailing list