Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: def __init__(self): Date: Tue, 26 Apr 2016 11:26:46 -0600 Lines: 10 Message-ID: References: <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> <85eg9sn7qo.fsf@benfinney.id.au> <87lh40pyik.fsf@elektro.pacujo.net> <571f9362$0$1602$c3e8da3$5496439d@news.astraweb.com> <1461687967.2507874.590200129.102244C8@webmail.messagingengine.com> <571f9836$0$1619$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de fjuxucez4SfgAEuyMc1PnAv509UA+D9ShJhWtvik+gbw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.069 X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; 'garbage': 0.09; 'it;': 0.09; 'python': 0.10; 'properly': 0.15; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:def': 0.16; 'zero,': 0.16; 'wrote:': 0.16; 'am,': 0.23; 'leave': 0.23; 'header :In-Reply-To:1': 0.24; 'chris': 0.26; 'message- id:@mail.gmail.com': 0.27; 'object,': 0.27; 'other,': 0.29; "i'd": 0.31; 'probably': 0.31; 'tue,': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'received:209.85.213': 0.37; 'wanted': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'care': 0.60; 'back': 0.62; 'more': 0.63; 'spend': 0.67; '26,': 0.72; 'casting': 0.84; 'subject:self': 0.84; 'to:name:python': 0.84; 'difficult,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=+eL6zqXV+rzkmPVsaRZDW3zkP/fP40TiN+kpxtq5JTA=; b=FslfHGH+i2NiPEol/ORfSiA1ERGqY1w8YDNcsqCbhZXrhgf/edV+h6I2a1toHGfxbx PWTOPLXWNuH5kUIUV7iDJh1n4Hh2KCYiX3AJ/N+tgLpWs8xnfdCCdpVgt1XB5uuBQnf1 9RLSPth9O3URR2uwI5C7WCJ/yOc2CrObF93hQvsdJOYE+f1GVZnvaIS5QIAQiyxvtXdA rPXsy9pTqrwhKK6zHDgBZvq2z6crMHhP3HVcqY/C6BRVWeJMGoragLwmNCOqwN5n2hfg 9GYUfCU16j4hg3N3tCUJU/Y3uGnl7MylYGhc2rGz+Y2W0gAPELHWN+pQS6J338EKiWF+ +JRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=+eL6zqXV+rzkmPVsaRZDW3zkP/fP40TiN+kpxtq5JTA=; b=YSygD2+wzMs9DM6GRk9OY63DtSwUR8maUZZGFXJ5xQvdW7WhP/ZBABIrZOKT7clCDT xIemIYxc8LeE45XS3I4T45WowsA0WZDONOMwio2qmC/7MMJHOBR6MNkWcK8Zaa2dg++r +R46P4aRsLHMeCMCCYyIVsxA/xFbwCPBQksSX3f+yg6LL5QRXYvkTYWtfwtiK8aNnkmy trk4NzfOxCJDVrXiQggnOVTtQiFu7QmGszOlllqvC+7WuVgdS8hRTzUb2zdsBloXGYQ/ SrO2X4wT+Mk2gbv11w+EH7/slF1kxUweftZhdyOypOEFLRLVNlVN8iGX65e9JQ+/4zbF kuUQ== X-Gm-Message-State: AOPr4FU+vU70bdfT98GmDH8oJVjmvFlvQ7o/Qg+zaDtRv/CNbJSLQs+Pj4o11962zkWg5i9NiO0U4keJbjILBw== X-Received: by 10.50.57.50 with SMTP id f18mr20994464igq.93.1461691648299; Tue, 26 Apr 2016 10:27:28 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <34e51ef5-9679-40ec-bc8f-47981353e9d7@googlegroups.com> <571F1361.3010402@digipen.edu> <85eg9sn7qo.fsf@benfinney.id.au> <87lh40pyik.fsf@elektro.pacujo.net> <571f9362$0$1602$c3e8da3$5496439d@news.astraweb.com> <1461687967.2507874.590200129.102244C8@webmail.messagingengine.com> <571f9836$0$1619$c3e8da3$5496439d@news.astraweb.com> Xref: csiph.com comp.lang.python:107678 On Tue, Apr 26, 2016 at 11:13 AM, Chris Kaynor wrote: > Yah, if you really wanted to make it work properly, you'd need to incref > the newValue, while decref the oldValue. The incref would not be that > difficult, but the decref would be more challenging, as you may have to > also destroy the old object, though that might be possible by casting it > back to a python object without the incref,. One way or the other, I did > not exactly spend a ton of time to make it work properly :) For the decref I'd probably just decrement it and leave it; if it's zero, the garbage collector will eventually take care of it.