RE: Lazy Attribute
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.
> From: email@example.com
> Subject: Re: Lazy Attribute
> Date: Fri, 16 Nov 2012 05:12:11 -0500
> To: firstname.lastname@example.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.
|All times are GMT. The time now is 01:20 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.