Re: probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Marcus Goldfish
On 12/29/06, Stef Mientki <[EMAIL PROTECTED]> wrote: Does anyone know the equivalent of the MatLab "diff" function. The "diff" functions calculates the difference between 2 succeeding elements of an array. I need to detect (fast) the falling edge of a binary signal. There's derivate function in

help with binary file io, perhaps with generators?

2005-04-23 Thread Marcus Goldfish
I need to write a "fast" file reader in python for binary files structured as: … x[0] y[0] z[0] x[1] y[1] z[1] … where c[k] is the k-th element from sequence c. As mentioned, the file is binary -- spaces above are just for visualization. Each element, c[k], is a 16-bit int. I can assume I kno

Re: internet explorer/firefox plugin/toolbar

2005-04-22 Thread Marcus Goldfish
> does anyone have any ideas as to how to go about creating a plugin/toolbar > for both/either the IE/Firefox browsers? For IE, checkout Browser Helper Objects (BHOs). Sample python code can be found at: http://aspn.activestate.com/ASPN/Mail/Message/ctypes-users/2263094 Marcus -- http://mail.pyt

Re: Using python from a browser

2005-04-15 Thread Marcus Goldfish
> > I read that IE had the capability to embedd Python scripts, but what > > about the others ? > > While Python can be set up as a scripting language for IE, this is > normally disabled as it could be a security hole. The open call is > available from Python scripts so a web site could read or

Re: pythonic use of properties?

2005-04-15 Thread Marcus Goldfish
On 4/15/05, Michael Spencer <[EMAIL PROTECTED]> wrote: > > class SillyDecimal(object): > >"""A silly class to represent an integer from 0 - 99.""" > >def __init__(self, arg=17): > >if isinstance(arg, tuple): > >self.tens = arg[0] > >self.ones = arg[1] > It is

pythonic use of properties?

2005-04-14 Thread Marcus Goldfish
I'd like advice/opinions on when it is appropriate to do attribute/property validation in python. I'm coming from a C#/Java background, where of course tons of "wasted" code is devoted to property validation. Here is a toy example illustrating my question: # Example: mixing instance attributes

Re: Finding attributes in a list

2005-04-02 Thread Marcus Goldfish
> class Player(object): >def __init__(self, **kw): self.__dict__.update(kw) >def __repr__(self): return ''%getattr(self, 'name', > '(anonymous)') > > import operator > [p.name for p in sorted(players, key=operator.attrgetter('attacking'), > reverse=True)] Just happened to read this threa