singleton ... again

Tim Delaney timothy.c.delaney at gmail.com
Wed Feb 12 18:08:07 EST 2014


On 13 February 2014 08:34, Ned Batchelder <ned at nedbatchelder.com> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140213/61fdf8eb/attachment.html>


More information about the Python-list mailing list