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


Groups > comp.lang.python > #39770

Re: intX.__str__() ??

Date 2013-02-24 13:44 -0500
From Mitya Sirenef <msirenef@lightbird.net>
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>
Newsgroups comp.lang.python
Message-ID <mailman.2423.1361731464.2939.python-list@python.org> (permalink)

Show all headers | 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