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


Groups > comp.lang.python > #45299

Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <titanix88@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.052
X-Spam-Evidence '*H*': 0.90; '*S*': 0.00; 'syntax': 0.04; 'interpreter': 0.05; 'class,': 0.07; 'back.': 0.09; 'code"': 0.09; 'override': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'descriptors.': 0.16; 'fits': 0.16; 'subject: \n ': 0.16; 'subject:python': 0.16; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'decorators': 0.24; 'errors.': 0.24; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'topic': 0.29; 'related': 0.29; 'message- id:@mail.gmail.com': 0.30; 'bunch': 0.31; 'steven': 0.31; 'class': 0.32; 'quite': 0.32; 'checking': 0.33; 'comment': 0.34; 'subject:with': 0.35; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'sometimes': 0.38; 'skip:& 10': 0.38; 'ability': 0.39; 'skip:& 20': 0.39; 'does': 0.39; 'strictly': 0.61; 'more': 0.64; 'url:blogspot': 0.65; 'talking': 0.65; 'reply': 0.66; 'opinions': 0.70; 'url:a': 0.72; 'subject:skip:A 10': 0.78; 'about?': 0.84; 'decorate': 0.84; 'fight,': 0.84; 'mood': 0.84; 'seriously,': 0.84; 'url:03': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:cc:content-type; bh=2akDAcqXZ8fdyqw58nwWh/UFR62RcULJZ8Yhu/TU7uI=; b=Fl88XPH85QA7BiNzHzyedimE/yM8iN7Lcbb6L1h/h2PIIBpbrT127XpljRXbOBqAic vjCMIDm5dHINrtVskpydoFJhB8JR8jilnPi5oKf7Fr1dQ4GrBBfoTUxhfkNmbJOpS0OL AQShtQ2c7vUiWiRFU3fCVyEZBLV84gTxr2v0l5wwL5PjKNC+mhhmyBD5ZcVrjpfrHd+J KYXYH55duLfVUcwDlw9retxIVlfeaqcXGbRqIfDZZk8Z/Se5r7k1lhmaTubkyU03hdxN Zng6WLhzcdJOm5rDuzqXOEc99SPGR8wcu2IleIw0M8fHX1Ek47i3AM6yHscg92AfF/uC yNgg==
MIME-Version 1.0
X-Received by 10.68.237.106 with SMTP id vb10mr28477262pbc.131.1368544194797; Tue, 14 May 2013 08:09:54 -0700 (PDT)
In-Reply-To <5184aac2$0$29997$c3e8da3$5496439d@news.astraweb.com>
References <mailman.1257.1367537690.3114.python-list@python.org> <518302d7$0$29971$c3e8da3$5496439d@news.astraweb.com> <mailman.1265.1367567552.3114.python-list@python.org> <5184aac2$0$29997$c3e8da3$5496439d@news.astraweb.com>
Date Tue, 14 May 2013 21:09:54 +0600
Subject Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError.
From "Mr. Joe" <titanix88@gmail.com>
Cc python-list <python-list@python.org>
Content-Type multipart/alternative; boundary=047d7b33cfc09728ac04dcaf06b1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1672.1368544198.3114.python-list@python.org> (permalink)
Lines 64
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368544198 news.xs4all.nl 15932 [2001:888:2000:d::a6]:47214
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45299

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Sorry for digging this old topic back. I see that my "'property' does not
play well with polymorphic code" comment generated some controversy. So
here's something in my defense:

Here's the link to stackoveflow topic I am talking about:

http://stackoverflow.com/questions/237432/python-properties-and-inheritance

The solution that fits my taste:
http://stackoverflow.com/a/14349742

A related blogpost:

http://requires-thinking.blogspot.com/2006/03/note-to-self-python-properties-are-non.html

Yes, I like decorators and descriptors. I also like the ability to create a
"virtual property" in a python class by binding a bunch of methods as
setter/getter. But I find the implementation of this "virtual property
feature" a bit awkward sometimes - every time I need to override a
getter/setter in a child class, I need to decorate them again. Some of you
may like this "explicitness", but I don't.

To Steven D'Aprano: Seriously, what's all the bashing in your last reply
about? You dissected my "thank-you reply" more strictly than the python
interpreter checking for syntax errors. Not in a mood for fight, but I find
your opinions about "bug finding time", "hacks" and "stackoverflow" quite
silly.

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


Thread

Debugging difficulty in python with __getattr__, decorated properties and AttributeError. "Mr. Joe" <titanix88@gmail.com> - 2013-05-03 05:34 +0600
  Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-03 00:20 +0000
    Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. "Mr. Joe" <titanix88@gmail.com> - 2013-05-03 13:52 +0600
      Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-04 06:29 +0000
        Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. "Mr. Joe" <titanix88@gmail.com> - 2013-05-14 21:09 +0600
        Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. dieter <dieter@handshake.de> - 2013-05-15 08:15 +0200
        Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. "Mr. Joe" <titanix88@gmail.com> - 2013-05-15 22:38 +0600
    Re: Debugging difficulty in python with __getattr__, decorated properties and AttributeError. dieter <dieter@handshake.de> - 2013-05-04 07:56 +0200

csiph-web