Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28101
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'languages,': 0.04; 'attributes': 0.07; 'class,': 0.07; 'computed': 0.07; 'see.': 0.07; 'suppose': 0.07; 'python': 0.09; '@property': 0.09; 'empty,': 0.09; 'subject:Function': 0.09; 'cc:addr:python-list': 0.10; 'stored': 0.10; 'def': 0.10; 'coordinates': 0.16; 'function?': 0.16; 'hidden,': 0.16; 'parentheses': 0.16; 'self.x,': 0.16; 'self.y': 0.16; 'y):': 0.16; 'wrote:': 0.17; 'instance,': 0.17; 'question.': 0.20; 'trying': 0.21; 'lets': 0.22; 'properties': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; 'cc:addr:gmail.com': 0.27; 'question': 0.27; 'indentation': 0.29; 'case,': 0.29; 'skip:_ 10': 0.29; 'source': 0.29; 'class': 0.29; 'usually': 0.30; 'up.': 0.31; 'code': 0.31; 'point': 0.31; 'could': 0.32; 'message.': 0.33; 'html,': 0.33; 'ones,': 0.33; 'quotes': 0.33; 'problem': 0.33; 'text': 0.34; 'sometimes': 0.35; 'but': 0.36; 'wanted': 0.36; 'cc:no real name:2**1': 0.36; 'subject:: ': 0.38; 'mark': 0.38; 'fact': 0.38; 'some': 0.38; 'nothing': 0.38; 'received:192': 0.39; 'where': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'most': 0.61; 'real': 0.61; 'email addr:gmail.com': 0.63; 'subject': 0.66; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'saw': 0.75; 'compose': 0.84; 'message).': 0.84; 'messed': 0.84; 'apparent': 0.91; 'angel': 0.93; 'subject:Are': 0.93 |
| Date | Thu, 30 Aug 2012 07:49:10 -0400 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | d@davea.name |
| Subject | Re: Are the property Function really useful? yes. |
| References | <6ab76fcc34adc04a8b113b77c1e85606@pc-20120706ouob> <503E0128.5070805@davea.name> |
| In-Reply-To | <503E0128.5070805@davea.name> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:Q5jvUjuLv1ayFdqL+8Vd49a2F3VvgEOvdvIwIbvRjTI wCzmLVkNgIOKDv6xKRGzeds9w0rZeop6MbcAbdtylnMr8mo2hN VjeaUEcXUAHn7uQzDUTUrzBBSGT64rKjn4ehl1zp8yPnQC+X2o P0VtFXgXIbpKkvSbJRKDhYUcdpv3N8sqN2k5sGlaQp5Z6OUuhV nkSRfuXTMpcw7hjvLSBZWkQcaM4lg4EY0hlY6zRnIo/OvW1Qwb pKBEiMbrLwkp+SE3VSsTUMoHVoOauHIFV8FhTXjpkMaimlEG81 Nt9MdO7YZ2zldXXwnTfi2TEciwnw25OId8Fk0tbmLv/Xf9mvQ= = |
| Cc | python-list@python.org, levinie001@gmail.com |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| Reply-To | d@davea.name |
| 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.3962.1346327375.4697.python-list@python.org> (permalink) |
| Lines | 51 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1346327375 news.xs4all.nl 6951 [2001:888:2000:d::a6]:45878 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:28101 |
Show key headers only | View raw
On 08/29/2012 07:46 AM, Dave Angel wrote:
> On 08/29/2012 06:32 AM, levinie001@gmail.com wrote:
>
>
I was trying to point out that your question was empty (no content in
the message). Mark also apparently saw an empty message. However, now
that Dieter has responded, with apparent quotes from your message, i see
what the problem was.
You composed an html message and sent it to a text forum. Many people
make that mistake, and the problem it usually causes is that source code
indentation is messed up. However, most mail programs send a text part
as well, and that's what we see. In your case, the text part was
empty, so I saw nothing but the subject line.
Please tell your mail program to compose TEXT message, not html, or this
problem could occur again.
Now to your question.
>> <div> </div>
>> <div>Where can i use the property function?</div></div></body></html>
In some languages, you get computed properties by writing getter and
setter functions, with names to match. Python lets you hide the fact
that the "property" is hidden, by letting you use ordinary syntax to
access it. For example, suppose you had a Point class, which stored the
x and y coordinates of a point on a plane. Suppose also that sometimes
you wanted to use polar coordinates. You might like the user of the
class to just interchangeably use the real attributes and the computed
ones, without having to use parentheses on some of them. (untested)
class Point(object):
def __init__(self, x, y):
self.x = x
self.y = y
@property
def radius(self):
return self.sqrt(self.x * self.x, self.y * self.y)
@property
def theta(self):
return math.atan(self.x, self.y)
Now, once you have a Point instance, you can use all four attributes pretty much interchangeably.
--
DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Are the property Function really useful? yes. Dave Angel <d@davea.name> - 2012-08-30 07:49 -0400
csiph-web