Implement logic on object.attribute and object.attribute()

Devin Jeanpierre jeanpierreda at gmail.com
Sun Nov 24 09:04:01 EST 2013


On Sun, Nov 24, 2013 at 5:45 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Sun, 24 Nov 2013 05:04:16 -0800, Devin Jeanpierre wrote:
>> Uh oh. What you want is impossible. You cannot call an attribute without
>> first accessing it. :(
>
> Not quite impossible. All you need is an object that behaves like a
> string, except it has a __call__ method. Here's a sketch of a solution,
> completely untested.

I admit that thought crossed my mind, but I assumed he didn't want a
GET+POST, and also "impossible" is often a nice shorthand for "the
possibility is extraordinarily awful".

-- Devin



More information about the Python-list mailing list