Pythonic way to do static local variables?

Charles Krug cdkrug at worldnet.att.net
Tue Apr 26 00:58:43 EDT 2005


On Mon, 25 Apr 2005 21:30:18 -0500, Jaime Wyant
<programmer.py at gmail.com> wrote:
> Well, if you're a c++ programmer, 

Well, my forte is embedded systems and device controls . . .

> then you've probably ran into
> `functors' at one time or another.  You can emulate it by making a
> python object that is `callable'.
> 
> class functor:
> 	def __init__(self):
> 		self.ordered_sequence = [1, 2, 3, 4, 5]
> 	def __call__(self, arg1, arg2):
> 		self.ordered_sequence.extend((arg1,arg2))
> 		self.ordered_sequence.sort()
> 		

"ordered" in this case doesn't mean "sorted." . . .
8-)

It's the set of filter coefficients and cumulative remainders for an
overlap add convolution.  Sorting would be . . . bad.  Like crossing the
streams bad.

Both of these techniques look promising here.


Thanks





More information about the Python-list mailing list