On Thu, 12 Mar 2015 21:38:00 +1300, Gregory Ewing
<greg.ew...@canterbury.ac.nz> wrote:

>
>I would just provide a function:
>
>_map = None
>
>def get_map():
>    global _map
>    if _map is None:
>       _map = Map()
>    return _map
>
>and document the fact that you shouldn't call Map()
>directly.

Oh, you are so right! Been so long since I last created a singleton I
forgot all about the idiomatic approaches to the pattern.

Thanks Greg. That is much, much, better.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to