Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64459

RE: Implementing append within a descriptor

From "Joseph L. Casale" <jcasale@activenetwerx.com>
Subject RE: Implementing append within a descriptor
Date 2014-01-21 22:52 +0000
References <df4a5fa31f874be2a4270cad9b73c4f5@exch.activenetwerx.com> <CAPTjJmr50WZcLvjgm35dhOdr+SUxgnCd4SaaC-e3h8rFOhRPpA@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5825.1390344784.18130.python-list@python.org> (permalink)

Show all headers | View raw


> 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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

RE: Implementing append within a descriptor "Joseph L. Casale" <jcasale@activenetwerx.com> - 2014-01-21 22:52 +0000

csiph-web