Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20061
| References | <21E56249-1F53-4316-8256-5C3B53E68BCE@gmail.com> |
|---|---|
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | 2012-02-09 04:05 -0500 |
| Subject | Re: what is the difference between @property and method |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5576.1328778348.27778.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: what is the difference between @property and method Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-09 04:05 -0500
csiph-web