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 Jon.Obermark
Recipients Jon.Obermark
Date 2012-09-07.15:44:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347032681.85.0.731459990005.issue15879@psf.upfronthosting.co.za>
In-reply-to
Content
If they are not going to call the __metaclass__ or the class __new__, then they should return `set` objects instead of subclass objects, so that it is clear what is going on.

As it is, the results of set operations receive some subclass information but not all.  So they are not really obeying the notion of a subclass: the results are neither `set` objects, nor properly-constructed objects of the `set` subclass.

e.g. 
class Fooset(Set):
  def __new__(cls, s = []):
    print 'New called'
    self = super(Fooset, cls).__new__(cls)
    self.update(s)
    if isinstance(s, Fooset):
      self.foo = s.foo
    else:
      self.foo = 'default'
    return self

x = Fooset([1,2,5])
y = x|x


The object `y` reports being of the type `Fooset`, but has not been constructed by the `type` that makes `Fooset` objects.
History
Date User Action Args
2012-09-07 15:44:41Jon.Obermarksetrecipients: + Jon.Obermark
2012-09-07 15:44:41Jon.Obermarksetmessageid: <1347032681.85.0.731459990005.issue15879@psf.upfronthosting.co.za>
2012-09-07 15:44:41Jon.Obermarklinkissue15879 messages
2012-09-07 15:44:40Jon.Obermarkcreate