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


Groups > comp.lang.python > #8064

Re: Instances' __setitem__ methods

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ethan@stoneleaf.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'instance': 0.05; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'instance.': 0.09; 'message- id:@stoneleaf.us': 0.09; 'pearson': 0.09; 'received:gator410.hostgator.com': 0.09; '~ethan~': 0.09; 'wrote:': 0.14; 'expected.': 0.16; 'fancy': 0.16; 'class,': 0.16; "subject:' ": 0.16; 'looked': 0.16; 'cc:addr:python-list': 0.17; 'header:In-Reply-To:1': 0.21; 'cc:2**0': 0.22; 'stuff': 0.22; 'cc:no real name:2**0': 0.23; 'trying': 0.23; 'object': 0.26; 'implement': 0.30; 'cc:addr:python.org': 0.30; 'header:User- Agent:1': 0.35; 'subject:: ': 0.38; 'some': 0.38; 'act': 0.65; 'received:websitewelcome.com': 0.67
Date Mon, 20 Jun 2011 20:37:34 -0700
From Ethan Furman <ethan@stoneleaf.us>
User-Agent Thunderbird 2.0.0.24 (Windows/20100228)
MIME-Version 1.0
To Spencer Pearson <speeze.pearson@gmail.com>
Subject Re: Instances' __setitem__ methods
References <13ffef25-879f-4d8f-8995-b4c358336c3d@o10g2000prn.googlegroups.com>
In-Reply-To <13ffef25-879f-4d8f-8995-b4c358336c3d@o10g2000prn.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator410.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - stoneleaf.us
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender c-67-170-168-84.hsd1.or.comcast.net ([192.168.74.5]) [67.170.168.84]:1759
X-Source-Auth ethan+stoneleaf.us
X-Email-Count 3
X-Source-Cap dG9idWs7dG9idWs7Z2F0b3I0MTAuaG9zdGdhdG9yLmNvbQ==
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.214.1308627516.1164.python-list@python.org> (permalink)
Lines 8
NNTP-Posting-Host 82.94.164.166
X-Trace 1308627516 news.xs4all.nl 49048 [::ffff:82.94.164.166]:34950
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8064

Show key headers only | View raw


Spencer Pearson wrote:
> I was recently trying to implement a dict-like object which would do
> some fancy stuff when it was modified, and found that overriding the
> __setitem__ method of an instance did not act the way I expected. 

The __magic__ methods are only looked up on the class, never the instance.

~Ethan~

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


Thread

Instances' __setitem__ methods Spencer Pearson <speeze.pearson@gmail.com> - 2011-06-20 18:42 -0700
  Re: Instances' __setitem__ methods Ethan Furman <ethan@stoneleaf.us> - 2011-06-20 20:37 -0700
  Re: Instances' __setitem__ methods Chris Rebert <clp2@rebertia.com> - 2011-06-20 22:12 -0700

csiph-web