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


Groups > comp.lang.python > #8064

Re: Instances' __setitem__ methods

Date 2011-06-20 20:37 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Instances' __setitem__ methods
References <13ffef25-879f-4d8f-8995-b4c358336c3d@o10g2000prn.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.214.1308627516.1164.python-list@python.org> (permalink)

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