[Python-Dev] PEP 399: Pure Python/C Accelerator Module Compatibility Requirements

Nick Coghlan ncoghlan at gmail.com
Mon Apr 18 04:58:54 CEST 2011


On Mon, Apr 18, 2011 at 3:50 AM, R. David Murray <rdmurray at bitdance.com> wrote:
> Thanks, your explanation seems to me to make a good case for making the
> decimal.py implementation less permissive.

Indeed. Since the current handling of Context in decimal.py violates
"Errors should never pass silently, unless explicitly silenced", I
would personally support a proposal to lock down its __setattr__ to a
predefined set of attributes, have its __delattr__ always raise an
exception, and introduce a parent ABC that is used for an isinstance()
check in setcontext(). (The ABC could include an attribute check, so
only objects that failed to provide all the appropriate methods and
attributes would raise the TypeError).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list