Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100990
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: using __getitem()__ correctly |
| Date | Thu, 31 Dec 2015 00:11:24 +1100 |
| Lines | 28 |
| Message-ID | <mailman.70.1451481087.11925.python-list@python.org> (permalink) |
| References | <n60kcc$h89$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| X-Trace | news.uni-berlin.de 5zEcHjC5pXLJi8/T5n7F8Aym7RAaEQKXx0LCqRc1lIew== |
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'cc:addr:python-list': 0.09; 'any.': 0.09; 'caveat': 0.09; 'here?': 0.09; 'subject:()': 0.09; 'subject:using': 0.09; 'wed,': 0.15; 'brackets:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'attribute': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'class,': 0.22; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'least': 0.27; 'message-id:@mail.gmail.com': 0.27; 'post': 0.31; 'skip:_ 10': 0.32; 'anybody': 0.32; 'received:google.com': 0.35; "isn't": 0.35; 'but': 0.36; 'there': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'thought': 0.37; '(with': 0.38; 'received:209': 0.38; 'why': 0.39; 'where': 0.40; 'called': 0.40; 'hello,': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'entire': 0.61; '30,': 0.63; 'subscript': 0.66; 'smith': 0.76; '(going': 0.84; 'chrisa': 0.84; 'to:none': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=gFp19vAgHzVdEd8gbKRWcNM8s3+xDpdUvagHERcODHI=; b=dCyEkeOajPLze/bbKCi6eEJWKaqnOd0cGX4ZA0OQhC4mJKB+/Xhy4sDEbqQUNYWieq OmG9y6x3HVQZZo0RLfIFGmm/O39tqkXgf4UJ9qRoB0vMM3AO6O8W3f/wK5oPNF8OmVBZ imA13kmV/J+fYz/OMLrusYNyrSU9SPYTMZt9eNtNM+NEYre3mGV7qw8+sJ1zOYMiAUyI qHpGMREd1GBbcof/5QHHOcLUzWGvlYOHWNGpGomyqLvTiFvmlzw3UomuiWmIG2ydEkmZ EqQC+Ehj3bpWMv/ijmtZIS84TZfw626GCexulDuyax+hhYvZZF0vBgrhqUkgOuJt/GSJ xNfw== |
| X-Received | by 10.107.40.76 with SMTP id o73mr2835371ioo.157.1451481084690; Wed, 30 Dec 2015 05:11:24 -0800 (PST) |
| In-Reply-To | <n60kcc$h89$1@dont-email.me> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:100990 |
Show key headers only | View raw
On Wed, Dec 30, 2015 at 11:57 PM, Charles T. Smith <cts.private.yahoo@gmail.com> wrote: > Hello, > > I thought __getitem__() was invoked when an object is postfixed with an > expression in brackets: > > - abc[n] > > and __getattr__() was invoked when an object is postfixed with an dot: > > - abc.member That would be normal (with the caveat that __getattr__ is called only if the attribute isn't found; __getattribute__ is called unconditionally). > but my __getitem__ is being invoked at this time, where there's no > subscript (going into a spiral recursion death): > > self.mcc = self.attrs.mcc > > Can anybody explain to me why __getitem__() would be invoked here? Can you post your entire class, or at least __getattr__? Also check superclasses, if there are any. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 12:57 +0000
Re: using __getitem()__ correctly Chris Angelico <rosuav@gmail.com> - 2015-12-31 00:11 +1100
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 14:40 +0000
Re: using __getitem()__ correctly Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-30 08:35 -0700
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 16:58 +0000
Re: using __getitem()__ correctly Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-30 13:40 -0700
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 22:54 +0000
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 22:58 +0000
Re: using __getitem()__ correctly Ben Finney <ben+python@benfinney.id.au> - 2015-12-31 10:13 +1100
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-30 23:18 +0000
Re: using __getitem()__ correctly Steven D'Aprano <steve@pearwood.info> - 2015-12-31 10:50 +1100
Re: using __getitem()__ correctly Ben Finney <ben+python@benfinney.id.au> - 2015-12-31 11:21 +1100
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-31 11:30 +0000
Re: using __getitem()__ correctly Ben Finney <ben+python@benfinney.id.au> - 2015-12-31 22:51 +1100
Re: using __getitem()__ correctly Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-12-31 12:12 +0000
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-31 13:39 +0000
Re: using __getitem()__ correctly Steven D'Aprano <steve@pearwood.info> - 2016-01-01 02:03 +1100
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-31 11:17 +0000
Re: using __getitem()__ correctly Steven D'Aprano <steve@pearwood.info> - 2016-01-01 01:43 +1100
Re: using __getitem()__ correctly Ian Kelly <ian.g.kelly@gmail.com> - 2015-12-30 17:31 -0700
Re: using __getitem()__ correctly "Charles T. Smith" <cts.private.yahoo@gmail.com> - 2015-12-31 12:45 +0000
csiph-web