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


Groups > comp.lang.python > #39770

Re: intX.__str__() ??

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <msirenef@lightbird.net>
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; 'operator': 0.03; 'enabling': 0.05; 'method.': 0.05; 'override': 0.07; 'notation': 0.09; 'oh,': 0.09; 'python:': 0.09; 'sentence': 0.09; 'underscore': 0.09; 'overriding': 0.16; 'performed.': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'define': 0.20; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'guess': 0.27; 'correct': 0.28; "d'aprano": 0.29; 'religion,': 0.29; 'steven': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'to:addr:python-list': 0.33; 'another': 0.33; 'pm,': 0.35; 'explain': 0.36; 'michael': 0.36; 'method': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'pays': 0.62; 'peace': 0.62; 'more': 0.63; 'making': 0.64; 'soul': 0.71; '2013': 0.84; 'overloading': 0.84; 'seriously,': 0.91
Date Sun, 24 Feb 2013 13:44:20 -0500
From Mitya Sirenef <msirenef@lightbird.net>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: intX.__str__() ??
References <512A3E85.6000307@stoneleaf.us> <512A4DF4.6060105@gmail.com> <mailman.2421.1361729399.2939.python-list@python.org> <512a5a95$0$29998$c3e8da3$5496439d@news.astraweb.com>
In-Reply-To <512a5a95$0$29998$c3e8da3$5496439d@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1; 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 <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.2423.1361731464.2939.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361731464 news.xs4all.nl 6963 [2001:888:2000:d::a6]:53794
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39770

Show key headers only | View raw


On 02/24/2013 01:23 PM, Steven D'Aprano wrote:
> On Sun, 24 Feb 2013 13:09:56  -0500, Mitya Sirenef wrote:
 >
 >> On 02/24/2013 12:29 PM, Michael Torrie wrote:
 >
 >> > Another way to explain the double underscore methods is that they are
 >> > how things like operator overloading is performed. Want to make a
 >> > class that you can use the [index] notation on instances? Define the
 >> > __get_attr__() method. And to define a class that you can then use
 >>
 >> small correction: it should be __getattr__()
 >
 >
 > Correct correction: it should be __getitem__ to override instance[item]
 > access. __getattr__ is for overriding instance.attribute.
 >
 >


Oh, yes.. I guess it pays to read more than a single sentence
when making corrections! -m


-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

Each religion, by the help of more or less myth, which it takes more or
less seriously, proposes some method of fortifying the human soul and
enabling it to make its peace with its destiny.  George Santayana

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: intX.__str__() ?? Mitya Sirenef <msirenef@lightbird.net> - 2013-02-24 13:09 -0500
  Re: intX.__str__() ?? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-24 18:23 +0000
    Re: intX.__str__() ?? Mitya Sirenef <msirenef@lightbird.net> - 2013-02-24 13:44 -0500

csiph-web