Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'obey': 0.09; 'pm,': 0.10; 'wrote:': 0.14; '(other': 0.16; 'dictionaries': 0.16; 'possibly': 0.16; 'header:In-Reply-To:1': 0.21; 'pair': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'objects': 0.23; 'object': 0.26; "i'm": 0.27; 'problem': 0.28; 'random': 0.28; 'class': 0.29; "won't": 0.30; 'second,': 0.30; 'strings,': 0.30; 'steven': 0.32; 'to:addr:python-list': 0.33; 'on,': 0.33; 'project': 0.33; '(for': 0.33; 'rule': 0.34; 'header:User-Agent:1': 0.35; "d'aprano": 0.35; 'surprised': 0.35; 'message-id:@gmail.com': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'but': 0.38; 'subject:: ': 0.38; 'received:192': 0.38; 'received:209': 0.39; 'flexibility': 0.39; 'to:addr:python.org': 0.39; 'received:192.168.1': 0.40; 'more': 0.60; 'subject:!': 0.67; 'accepts': 0.68; '09:13': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=Rg9bKyP0EOdP+WLTDo5iGwkGL4tzURhfnQtCkdSEQVw=; b=HHVuskighh0NsC9YJ0wOXaMCT2NDhTtMkWu4Wcz6/4u1/X0cmz9WaKkhUiH8bpG1/D d9fSlgaX6HeAy5qTO8RdHGcceR42v+HYLPdKyjEg83z5uAXE62bb5JQiXohO5v8siWBX 8XdEKumVpEmg8V5H3HLHL3RPZO5GPqMTx+jr4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=QuNrMfXydzuyP93NIXVQ7/TWpcTjg1+ruT1NEl3zp6Pb88WAweNN41ZsGpdSocmfnK QzMwYb1Izij/8qyw4tjik7HkmX7eWrHl/ITuaaJEljL36WIqazUm2g63hSSKYbhX3PBB Q/fmqV0lYrVu4WUxeOwtHRhwc5T/p1Skwo3MA= Date: Sat, 11 Jun 2011 21:28:40 -0500 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 MIME-Version: 1.0 To: "comp.lang.python" Subject: Re: __dict__ is neato torpedo! References: <4df420b6$0$30002$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <4df420b6$0$30002$c3e8da3$5496439d@news.astraweb.com> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1307845734 news.xs4all.nl 49184 [::ffff:82.94.164.166]:41339 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7467 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)?