Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39766
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'method.': 0.05; 'python': 0.09; 'notation': 0.09; 'python:': 0.09; 'underscore': 0.09; 'break!': 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; 'striving': 0.16; 'wrote:': 0.17; 'possess': 0.17; 'code.': 0.20; 'define': 0.20; 'written': 0.20; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'wonder': 0.27; 'skip:_ 10': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'code': 0.31; 'not.': 0.32; "he's": 0.33; 'to:addr:python-list': 0.33; 'another': 0.33; 'pm,': 0.35; 'explain': 0.36; 'michael': 0.36; 'should': 0.36; 'uses': 0.37; 'maintaining': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'sure': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'matter': 0.61; 'first': 0.61; 'course.': 0.62; 'quality': 0.69; 'introduce': 0.80; 'overloading': 0.84; 'habit': 0.91; 'hungarian': 0.91 |
| Date | Sun, 24 Feb 2013 13:09:56 -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> |
| In-Reply-To | <512A4DF4.6060105@gmail.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.2421.1361729399.2939.python-list@python.org> (permalink) |
| Lines | 24 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1361729399 news.xs4all.nl 6875 [2001:888:2000:d::a6]:38393 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:39766 |
Show key headers only | 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 | Next — Next in thread | Find similar | Unroll 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