Terry J. Reedy added the comment:

I do not think IEEEContext should not be made a class rather than a function 
until it really *is* a subclass with altered or added behavior. This means at 
least its own __str__ method and in this case, a __setattr__ that enforces the 
invariants. Here that means refusing to modify the context, or at least not 
prec and Emax (assuming that changes to any other context attributes (are there 
any?) are harmless. Something like

  def __setattr__(self, key, value):
    if key in ('prec', 'Emax'):
      raise AttributeError("cannot change {} of IEEEContext".format(key))
    else:
      super(IEEEContext, self).__setattr__(key, name)

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8786>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to