I have a descriptor of data collection in the dictionary of the host object and I have a range of hierarchy The fields of this descriptor are:
class identifier (object): def __init __ (self, main name = 'descr'): self.keyname = keyname def __get__ (object, own keyname, Val) Class A (Object): F = Adapteror ('' Object '' 'Object' Key A ': Class B (A): F = Edscript R ('kb') b = b () bf = 'b' print super (b, b) .f super (b, b) .f = 'a' the last line Do not work: Super (B, B). F = 'A'
Why do not you get work and set set? Set ['F']. Set <
Correct:
In a form given in my initial post, the AF has identified the name of A (missing) or default 8192- Named property is evaluated - do nothing with it. That is why I have a dict ['F'] - Receive used to exclude calls. def __get __ (self, obj, objtype = none): If there is no obj, then there is a need to make a small change if # Bold descriptor is not returned only if a bound object is not returned. In this case Af__set __ (b, 'a') works but it is still ugly! @BigAl is not good for my needs offered by asset solutions - I will need to wrap all my details in the property. "post-text" itemprop = "text"> Definitely Af__set __ (b, 'a') will work if a. D. DC ['F'] .__ set __ (b, 'a') works? And even then AFB = 'A' something to work, though if you work in my memory then you may have to specify it as a property
View history to see brain-based information ...
& gt; & Gt; & Gt; Class adcriptor: def __init __ (self, key name = 'descr'): self.keyname = keyname def __get __ (auto, obj, objtype): return (self.keyname, getattr (obj, self.keyname, 8192)) Def __set __ (self, oz, val): setter (obje, self keyname, val)> gt; & Gt; & Gt; Class A (Object): F = Adapteror ('key') & gt; & Gt; & Gt; Class B (A): F = Adapteror ('kb')> gt; & Gt; & Gt; A, B = A (), B ()> gt; & Gt; & Gt; Print (AF, B.F., A.F., B.F.) (('Key A', 8192), ('Kiba', 8192), ('Key A', 8192), ( 'Kabbi', 8192))) & Gt; & Gt; B.F. = 'B' & gt; & Gt; & Gt; Print (AF, BF, F, BF) (('Key A', 8192), ('Keb', 'B'), ('Keya', 8192), ('Keyby', 8192)> gt; & Gt; & Gt; AF = 'A' & gt; & Gt; & Gt; Print (AF, BF, AF, BF) ('A', ('KB', 'B'), 'A', ('KBI', 8192) Do you get it right?
What were you trying to do with Super (I changed the __ get __ for debugging , How it has been changed back)
Comments
Post a Comment