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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to