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


Groups > comp.lang.python > #7467

Re: __dict__ is neato torpedo!

Date 2011-06-11 21:28 -0500
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: __dict__ is neato torpedo!
References <mailman.140.1307842367.11593.python-list@python.org> <4df420b6$0$30002$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.143.1307845734.11593.python-list@python.org> (permalink)

Show all headers | View raw


On 2011.06.11 09:13 PM, Steven D'Aprano wrote:
> So never update from a random object you don't know well.
Of course. In the project I'm working on, this will be used in the
__init__() method of a class that accepts a pair of dictionaries or
possibly **kwargs (for flexibility and to avoid the very problem of an
object without a __dict__).
> A second, more subtle risk: not all objects have a __dict__. But if you 
> obey the rule about never updating from arbitrary objects you don't know, 
> then you won't be surprised by an object with no __dict__.
What objects don't (other than the obvious ones like strings,
dictionaries, ints and lists)?

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


Thread

__dict__ is neato torpedo! Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 20:32 -0500
  Re: __dict__ is neato torpedo! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-12 02:13 +0000
    Re: __dict__ is neato torpedo! Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 21:28 -0500
      Re: __dict__ is neato torpedo! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-12 08:47 +0000
        Re: __dict__ is neato torpedo! Hans Mulder <hansmu@xs4all.nl> - 2011-06-12 17:20 +0200

csiph-web