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


Groups > comp.lang.python > #60364

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

References <CA+DCN_uqn5OukuZ5QWWjJCUTksaFw50L03ZU7uqdm4a6ZOn7CA@mail.gmail.com>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date 2013-11-24 05:04 -0800
Subject Re: Implement logic on object.attribute and object.attribute()
Newsgroups comp.lang.python
Message-ID <mailman.3128.1385298299.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Nov 24, 2013 at 4:52 AM, Marc Aymerich <glicerinu@gmail.com> wrote:
> Hi,
> I'm playing with python internals to make objects behave like this:
>
> if I access to "object.attribute" I want to return the result of an
> HTTP GET request. However if i call "object.attribute()" I want an
> HTTP POST request to be executed.

Uh oh. What you want is impossible. You cannot call an attribute
without first accessing it. :(

-- Devin

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


Thread

Re: Implement logic on object.attribute and object.attribute() Devin Jeanpierre <jeanpierreda@gmail.com> - 2013-11-24 05:04 -0800
  Re: Implement logic on object.attribute and object.attribute() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-24 13:45 +0000
    Re: Implement logic on object.attribute and object.attribute() Devin Jeanpierre <jeanpierreda@gmail.com> - 2013-11-24 06:04 -0800
    Re: Implement logic on object.attribute and object.attribute() Chris Angelico <rosuav@gmail.com> - 2013-11-25 01:13 +1100
      Re: Implement logic on object.attribute and object.attribute() Roy Smith <roy@panix.com> - 2013-11-24 09:21 -0500
        Re: Implement logic on object.attribute and object.attribute() Chris Angelico <rosuav@gmail.com> - 2013-11-25 01:31 +1100
    Re: Implement logic on object.attribute and object.attribute() Chris Angelico <rosuav@gmail.com> - 2013-11-25 01:13 +1100
    Re: Implement logic on object.attribute and object.attribute() Marc Aymerich <glicerinu@gmail.com> - 2013-11-24 15:16 +0100
    Re: Implement logic on object.attribute and object.attribute() Chris Angelico <rosuav@gmail.com> - 2013-11-25 01:37 +1100
      Re: Implement logic on object.attribute and object.attribute() Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-11-24 15:11 +0000
    Re: Implement logic on object.attribute and object.attribute() Marc Aymerich <glicerinu@gmail.com> - 2013-11-24 15:34 +0100
    Re: Implement logic on object.attribute and object.attribute() Marc Aymerich <glicerinu@gmail.com> - 2013-11-24 15:48 +0100
    Re: Implement logic on object.attribute and object.attribute() Chris Angelico <rosuav@gmail.com> - 2013-11-25 01:57 +1100

csiph-web