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


Groups > comp.lang.python > #39766

Re: intX.__str__() ??

Date 2013-02-24 13:09 -0500
From Mitya Sirenef <msirenef@lightbird.net>
Subject Re: intX.__str__() ??
References <512A3E85.6000307@stoneleaf.us> <512A4DF4.6060105@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2421.1361729399.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 02/24/2013 12:29 PM, Michael Torrie wrote:
>
 > I think he's maintaining existing code. It's unfortunate that his first
 > exposure to python is code written by someone else in such a poor style,
 > and in a way that definitely isn't pythonic. No wonder he's struggling
 > to like python! Though I'm sure since his recent experience has been
 > exclusively in C# that he probably uses hungarian notation as a matter
 > of course. A hard habit to break! Is this a good time to introduce him
 > to duck typing? Probably not.
 >
 > 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__()


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

Admiration for a quality or an art can be so strong that it deters us from
striving to possess it.  Friedrich Nietzsche

Back to comp.lang.python | Previous | NextNext 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