Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76915
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <elearn2014@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'tutorial': 0.03; 'attribute': 0.07; 'c++,': 0.07; 'skip:p 60': 0.07; 'feature,': 0.09; 'subject:still': 0.09; 'python': 0.11; 'def': 0.12; '24,': 0.16; '6:56': 0.16; 'attribute,': 0.16; 'bug:': 0.16; 'descriptor': 0.16; 'lambda': 0.16; 'properties,': 0.16; 'subject:)?': 0.16; 'utterly': 0.16; 'wrote:': 0.18; 'trying': 0.19; "python's": 0.19; 'aug': 0.22; 'header:User-Agent:1': 0.23; 'deleted.': 0.24; 'java': 0.24; 'looks': 0.24; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'chris': 0.29; 'am,': 0.29; 'properties': 0.29; "doesn't": 0.30; 'especially': 0.30; 'class': 0.32; 'run': 0.32; 'skip:_ 10': 0.34; 'maybe': 0.34; 'skip:d 20': 0.34; 'subject:the': 0.34; 'classes': 0.35; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; "you're": 0.61; "you'll": 0.62; "you've": 0.63; 'kind': 0.63; 'dear': 0.65; 'to:addr:gmail.com': 0.65; 'charset:windows-1252': 0.65; 'here': 0.66; 'look.': 0.84; 'subject:man': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=7x1ald3KdHrqoUxm1GaeiORheSllxXC24YIsSGtljUk=; b=mW+hHIEqPjGz+Km8SPxQvRDhL7C+ioBJED13Z1Q4dpODanh3JDkyunNgvk6mAzjBHu AmecaOtVONH14d/L8wEm2yfAH/lJ0LIsfUNbjJLcN96GMmuH59jkk0g8mwR6L1vVYqKQ ZtnrZEjRBYWCgJwfXcmyvN2OuGrwKumowJGZVzNKAMQhWs/YnKWcHIK7CKQdyGJf1962 K0FvQXkOXarMLTMTe35ofcJie8Q3uf6YwmgocD4XUiTLGqaRABPdtT41+4U272NJP++O SdxkFmuIxs/4BP1uJ9zo4qGsLssIEwpb/d7qaLJ9871pE5sPbeBfdRAe2VAGpmam0fzB FiLg== |
| X-Received | by 10.68.65.36 with SMTP id u4mr16459601pbs.127.1408836974755; Sat, 23 Aug 2014 16:36:14 -0700 (PDT) |
| Date | Sun, 24 Aug 2014 07:35:47 +0800 |
| From | luofeiyu <elearn2014@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
| MIME-Version | 1.0 |
| To | Chris Angelico <rosuav@gmail.com>, python-list@python.org |
| Subject | Re: why the attribute be deleted still in dir(man)? |
| References | <53F91A91.6080205@gmail.com> <CAPTjJmoTrJem_FvuKMdfbii5=q5T5JrrSXiuNLn879gOig=Maw@mail.gmail.com> |
| In-Reply-To | <CAPTjJmoTrJem_FvuKMdfbii5=q5T5JrrSXiuNLn879gOig=Maw@mail.gmail.com> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13366.1408836983.18130.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408836983 news.xs4all.nl 2940 [2001:888:2000:d::a6]:41270 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76915 |
Show key headers only | View raw
dear ChrisA ,dynamic is python feature, it is to create descriptor in run time , that is the meaning in the codes,and maybe it is a bug: the attribute can be displayed in dir(man) after be deleted. On 8/24/2014 6:56 AM, Chris Angelico wrote: > On Sun, Aug 24, 2014 at 8:49 AM, luofeiyu <elearn2014@gmail.com> wrote: >> class Person(object): >> def addProperty(self, attribute): >> getter = lambda self: self._getProperty(attribute) >> setter = lambda self, value: self._setProperty(attribute, >> value) >> deletter = lambda self:self.delProperty(attribute) >> setattr(self.__class__, attribute, >> property(fget=getter,fset=setter,fdel=deletter,doc="Auto-generated method")) >> def _setProperty(self, attribute, value): >> setattr(self, '_' + attribute, value.title()) >> def _getProperty(self, attribute): >> return getattr(self, '_' + attribute) >> def delProperty(self,attribute): >> delattr(self,'_' + attribute) > Look. Forget properties. Python is not Java or C++, and you almost > never need this kind of thing. Read up a tutorial on doing classes > Python's way, and you'll find that all this sort of thing just doesn't > matter. You've come here with a significant number of questions about > properties, and it looks as if you're trying to do everything through > them - which is utterly and completely useless, especially when you > use properties to be as dynamic as you're doing. Just don't do it. > > ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: why the attribute be deleted still in dir(man)? luofeiyu <elearn2014@gmail.com> - 2014-08-24 07:35 +0800
csiph-web