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


Groups > comp.lang.python > #20061 > unrolled thread

Re: what is the difference between @property and method

Started byDevin Jeanpierre <jeanpierreda@gmail.com>
First post2012-02-09 04:05 -0500
Last post2012-02-09 04:05 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: what is the difference between @property and method Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-09 04:05 -0500

#20061 — Re: what is the difference between @property and method

FromDevin Jeanpierre <jeanpierreda@gmail.com>
Date2012-02-09 04:05 -0500
SubjectRe: what is the difference between @property and method
Message-ID<mailman.5576.1328778348.27778.python-list@python.org>
On Thu, Feb 9, 2012 at 3:50 AM, Zheng Li <dllizheng@gmail.com> 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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web