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


Groups > comp.lang.python > #33421

Re: Lazy Attribute

From Rouslan Korneychuk <rouslank@msn.com>
Newsgroups comp.lang.python
Subject Re: Lazy Attribute
References <CALwzidnenqoEBmzY1Xoe-BfKV-v1crRV2CdeLj1asD1ZWBDo_A@mail.gmail.com> <mailman.3734.1353052215.27098.python-list@python.org>
Message-ID <tKnps.2$tm5.0@newsfe08.iad> (permalink)
Date 2012-11-16 04:32 -0500

Show all headers | View raw


On 11/16/2012 02:49 AM, Andriy Kornatskyy wrote:
>> If accessing the descriptor on the class object has no special
>> meaning, then the custom is to return the descriptor object itself, as
>> properties do.
>
> If I would satisfy this, I will be forced to check for None 99.9% of the use cases (it is not None, being applied to an object). Thus it behaves as designed.

That's not true. You can use a try-except block to return the descriptor 
object when an AttributeError is raised.

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


Thread

RE: Lazy Attribute Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-16 10:49 +0300
  Re: Lazy Attribute Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-16 09:04 +0000
    RE: Lazy Attribute Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-16 13:27 +0300
  Re: Lazy Attribute Rouslan Korneychuk <rouslank@msn.com> - 2012-11-16 04:32 -0500
    Re: Lazy Attribute Rouslan Korneychuk <rouslank@msn.com> - 2012-11-16 05:12 -0500
      RE: Lazy Attribute Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2012-11-16 13:31 +0300

csiph-web