This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients ezio.melotti, facundobatista, maker, mark.dickinson, rhettinger, skrah, terry.reedy
Date 2012-10-14.18:51:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350240706.09.0.661508323295.issue8786@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2012-10-14 18:51:46terry.reedysetrecipients: + terry.reedy, rhettinger, facundobatista, mark.dickinson, ezio.melotti, skrah, maker
2012-10-14 18:51:46terry.reedysetmessageid: <1350240706.09.0.661508323295.issue8786@psf.upfronthosting.co.za>
2012-10-14 18:51:46terry.reedylinkissue8786 messages
2012-10-14 18:51:45terry.reedycreate