Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'interpreter': 0.05; 'python"': 0.07; 'googling': 0.09; 'subject:method': 0.09; 'am,': 0.12; 'def': 0.13; 'subject:between': 0.16; 'cc:addr:python-list': 0.16; 'url:blog': 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'maybe': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'cc:2**0': 0.26; 'code': 0.26; 'message-id:@mail.gmail.com': 0.29; 'explicitly': 0.29; 'class': 0.29; 'cc:addr:python.org': 0.29; 'received:209.85.210.46': 0.30; 'received:mail- pz0-f46.google.com': 0.30; 'url:2008': 0.30; 'url:library': 0.31; 'thu,': 0.32; 'there': 0.33; 'it.': 0.33; 'calling': 0.34; 'skip:@ 10': 0.34; 'url:python': 0.35; 'received:google.com': 0.37; 'difference': 0.38; 'received:209.85': 0.38; 'url:org': 0.39; 'received:209': 0.39; 'change': 0.40; 'kind': 0.62; 'property': 0.63; 'is.': 0.63; 'ever': 0.64; 'funny': 0.76; 'url:aug': 0.84; 'url:functions': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SsN54rv2/PmItgUI0gKkaNTCrz22pkBhM8Ynpl/GkGo=; b=vlv7P4AZIWjzdVstbSWldSE2mNpJjRspbQ250e4IxZWHmr5VRDQS1SgC2AVVbywGYV ciWNglUl+Ki8Vmlra1OtNpsDzw36x2PbJtFz1CxH5fMxqtoglaoJFujxGwvuzHZbJ+DH oW+Veg6gY2SiPpiwsEixBmt4A5QFN4MWWtN1M= MIME-Version: 1.0 In-Reply-To: <21E56249-1F53-4316-8256-5C3B53E68BCE@gmail.com> References: <21E56249-1F53-4316-8256-5C3B53E68BCE@gmail.com> From: Devin Jeanpierre Date: Thu, 9 Feb 2012 04:05:06 -0500 Subject: Re: what is the difference between @property and method To: Zheng Li Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328778348 news.xs4all.nl 6907 [2001:888:2000:d::a6]:55424 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20061 On Thu, Feb 9, 2012 at 3:50 AM, Zheng Li wrote: > class A(object): > @properymethod > def value1(self): > return 'value1' > > def value2(self): > return 'value2' > > what is the difference between value1 and value2. There is no such thing as @properymethod After you change the code to use @property, try writing it in the interactive interpreter and calling A().value2(). Then try calling A().value1() . Or maybe try googling for it. The fourth result for "property python" for me is http://adam.gomaa.us/blog/2008/aug/11/the-python-property-builtin/ -- It is kind of funny that the docs don't ever explicitly say what a property is. http://docs.python.org/library/functions.html#property -- Devin