Emmanuel Briot wrote:
> I am participating in the development of a GPL IDE
>    https://libre2.adacore.com/gps/
> I am not really good at python, but I was trying to implement the
> singleton design pattern in C, so that for instance calling the constructor
>    ed = Editor ("foo")

Fredrik's advice is probably better, but if you must:

class Editor(object):
     table = {}
     def __new__(klass, name):
         try:
             return klass.table[name]
         except KeyError:
             klass.table[name] = super(Singled, klass).__new__(klass)
         return klass.table[name]

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to