__new__() does not return anything, on singletong pattern

Gregory Ewing greg.ewing at canterbury.ac.nz
Thu Mar 12 04:40:03 EDT 2015


Mario Figueiredo wrote:

> A different application, a map editor, needs to also instantiate an
> object of the class Map. But in this case the map needs to either be
> empty (if the user wants to create a new map), or loaded from the
> saved map file (if the user wants to edit an existing map).

Then you have two functions for creating maps:

new_empty_map()

load_map_from_file(filename)

Both of these can complain if there is already a
Map instance.

-- 
Greg



More information about the Python-list mailing list