[SciPy-Dev] Code question about signal.ltisys.py

Pauli Virtanen pav at iki.fi
Tue May 22 05:11:56 EDT 2012


Warren Weckesser <warren.weckesser <at> enthought.com> writes:
[clip]
> self.__dict__['num'], self.__dict__['den'] = normalize(*args)
> 
> My inclination is to rewrite that as
>
> self.num, self.den = normalize(*args)
>
> But am I missing something?

These lines are equivalent, *unless* the class has __setattr__ defined.
That's the case here, so rewriting may end up in different behavior
than intended, depending on what __setattr__ does.

    Pauli





More information about the SciPy-Dev mailing list