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


Groups > comp.lang.python > #33427

RE: Lazy Attribute

From Andriy Kornatskyy <andriy.kornatskyy@live.com>
Subject RE: Lazy Attribute
Date 2012-11-16 13:31 +0300
References <%jops.44$TT7.13@newsfe04.iad>
Newsgroups comp.lang.python
Message-ID <mailman.3743.1353061987.27098.python-list@python.org> (permalink)

Show all headers | View raw


This is very minor use case. Unlikely useful to add any checks for None, or translate one exception to the other... with pretty much the same outcome: it makes sense in objects only.

Thanks.

Andriy

----------------------------------------
> From: rouslank@msn.com
> Subject: Re: Lazy Attribute
> Date: Fri, 16 Nov 2012 05:12:11 -0500
> To: python-list@python.org
>
> On 11/16/2012 04:32 AM, Rouslan Korneychuk wrote:
> > 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.
>
> Actually, never mind. I just realized the function has to be called
> before the attribute can be set, which can not-only raise any exception,
> but could potentially have undesired side-effects given a parameter it
> doesn't expect.
> --
> http://mail.python.org/mailman/listinfo/python-list
 		 	   		  

Back to comp.lang.python | Previous | NextPrevious 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