Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'patterns': 0.04; 'wednesday,': 0.07; 'pretend': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; '12:50': 0.16; 'goal,': 0.16; 'instances,': 0.16; 'lie': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'tests': 0.22; 'header:User-Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'code': 0.31; 'object.': 0.31; 'class': 0.32; 'thanks!': 0.32; 'actual': 0.34; 'could': 0.34; 'knowledge': 0.35; 'one,': 0.35; 'but': 0.35; 'building': 0.35; 'there': 0.35; 'object,': 0.36; 'doing': 0.36; 'unit': 0.37; 'las': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'dave': 0.60; 'new': 0.61; 'effective': 0.61; 'act': 0.63; 'judge': 0.68; 'useful.': 0.68; 'everywhere.': 0.84; 'examples.': 0.84; 'angel': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ned Batchelder Subject: Re: singleton ... again Date: Wed, 12 Feb 2014 16:34:34 -0500 References: <9785668d-6bea-4382-8a0c-c1258f2e2693@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 18.189.30.229 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <9785668d-6bea-4382-8a0c-c1258f2e2693@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392240886 news.xs4all.nl 2967 [2001:888:2000:d::a6]:55818 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66095 On 2/12/14 12:50 PM, Asaf Las wrote: > On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote: >> >> Perhaps if you would state your actual goal, we could judge >> whether this code is an effective way to accomplish >> it. >> DaveA > > Thanks! > > There is no specific goal, i am in process of building pattern knowledge > in python by doing some examples. > Not all patterns are useful. Just because it's been enshrined in the GoF patterns book doesn't mean that it's good for Python. I don't understand why you would like a class to pretend to make new instances, but actually lie and return the same instance over and over. It makes them impossible to test: your unit tests all act on the same object, there's no way to start over with a fresh object. If you only want one object, create just one, and use it everywhere. -- Ned Batchelder, http://nedbatchelder.com