Message169986
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. |
|
Date |
User |
Action |
Args |
2012-09-07 15:44:41 | Jon.Obermark | set | recipients:
+ Jon.Obermark |
2012-09-07 15:44:41 | Jon.Obermark | set | messageid: <1347032681.85.0.731459990005.issue15879@psf.upfronthosting.co.za> |
2012-09-07 15:44:41 | Jon.Obermark | link | issue15879 messages |
2012-09-07 15:44:40 | Jon.Obermark | create | |
|