Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'patterns': 0.04; 'wednesday,': 0.07; 'python': 0.11; '12:50': 0.16; 'attribute.': 0.16; 'goal,': 0.16; 'implemented,': 0.16; 'iterators': 0.16; 'singleton': 0.16; 'which,': 0.16; 'wrote:': 0.18; 'module': 0.19; '>>>': 0.22; 'header:In-Reply- To:1': 0.27; 'tim': 0.29; 'related': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'thanks!': 0.32; 'style': 0.33; 'to:name:python-list': 0.33; 'actual': 0.34; 'could': 0.34; 'knowledge': 0.35; 'objects': 0.35; 'received:google.com': 0.35; 'building': 0.35; 'there': 0.35; 'really': 0.36; 'programming,': 0.36; 'doing': 0.36; 'example,': 0.37; 'las': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; '12,': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'dave': 0.60; 'effective': 0.61; 'judge': 0.68; 'useful.': 0.68; 'batchelder': 0.84; 'examples.': 0.84; 'pervasive': 0.84; 'visitor': 0.84; 'angel': 0.91; 'sitting': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=EllMDDhAtiUYmO12uwSSgIzXUvL4MeLCZTSgRL+ciqY=; b=E2fy/6RjRP/wiVimaxM+5IPtBK8Ma0WaxeZjJqJaBY46mFCNDbEp0QpMrftMvUvpfP 8WWWbCPJ6f4Qhw05Gshy7Ti+lTi0LDx3B1yrMTatuG1Nkr1dyI8dIHkVsvw0aZhU/Wr9 RkDoTarLNcIqVeBmFA8vHhfaOlb7cWJplT9dRXBaliY+n4JxjxHOEU6pFTPUs13C1UZi 9xNzj0RvuOxGRgBaj/m2FODpzUx9LZH+CjNzc0bKnvTxam0wbL9mI3EFpT+lIdiUmHbP ORs6Nl9EGdKeWu3CSa7rK72X7iqQ08R7EUO04iDohmar03/0dSTFPxkNhH6Bx3qWn/Ck HNqA== MIME-Version: 1.0 X-Received: by 10.182.92.231 with SMTP id cp7mr13764obb.82.1392246487494; Wed, 12 Feb 2014 15:08:07 -0800 (PST) In-Reply-To: References: <9785668d-6bea-4382-8a0c-c1258f2e2693@googlegroups.com> Date: Thu, 13 Feb 2014 10:08:07 +1100 Subject: Re: singleton ... again From: Tim Delaney To: Python-List Content-Type: multipart/alternative; boundary=001a11c302cc53b7f204f23da5da 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: 83 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1392246496 news.xs4all.nl 2846 [2001:888:2000:d::a6]:35567 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:66115 --001a11c302cc53b7f204f23da5da Content-Type: text/plain; charset=UTF-8 On 13 February 2014 08:34, Ned Batchelder wrote: > 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. > Speaking of which, my monitor is currently sitting on my copy of "Design Patterns". A lot of "Design Patterns" isn't directly relevant to Python, because Python either already has various patterns implemented, or obviates the need for them. For example, if you really need a singleton (answer - you don't) just use a module attribute. Functions as objects and iterators being so pervasive means that visitor and related patterns are just a normal style of programming, instead of having to be explicit. Tim Delaney --001a11c302cc53b7f204f23da5da Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On 1= 3 February 2014 08:34, Ned Batchelder <ned@nedbatchelder.com> wrote:
On 2/12/14 12:50 PM, Asaf La= s wrote:
On Wednesday, February 12, 2014 7:48:51 AM UTC+2, Dave Angel wrote:

Perhaps if you would state your actual goal, =C2=A0we could judge
=C2=A0 whether this code is an effective way to accomplish
=C2=A0 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. =C2=A0Just because it's been enshrined in = the GoF patterns book doesn't mean that it's good for Python.

Speaking of which, my monitor is currently s= itting on my copy of "Design Patterns".

A lot of "Design Patterns" isn't directly= relevant to Python, because Python either already has various patterns imp= lemented, or obviates the need for them. For example, if you really need a = singleton (answer - you don't) just use a module attribute. Functions a= s objects and iterators being so pervasive means that visitor and related p= atterns are just a normal style of programming, instead of having to be exp= licit.

Tim Delaney=C2=A0
--001a11c302cc53b7f204f23da5da--