Implementing append within a descriptor
Joseph L. Casale
jcasale at activenetwerx.com
Tue Jan 21 17:52:42 EST 2014
> You're going to have to subclass list if you want to intercept its
> methods. As I see it, there are two ways you could do that: when it's
> set, or when it's retrieved. I'd be inclined to do it in __set__, but
> either could work. In theory, you could make it practically invisible
> - just check to see if you're trying to __set__ a list, and if you
> are, set a magical list instead.
Hey Chris,
That actually is sufficient, assignment can be intercepted and retyped so
an append will accomplish what I need.
Thanks!
jlc
More information about the Python-list
mailing list