In article <mailman.1308.1161912647.11739.python-list at python.org>,
Ben Finney <ben at benfinney.id.au> wrote:
>>Fourth, if you have decided that a magic sentinel value is called for
>but None is already taken for some other purpose, don't use a
>string. Use a unique do-nothing object, defined at the module level so
>callers can easily get at it, like 'Dmitry Vasiliev' showed
>[reproduced below].
>> GLOBAL = object()
>> def insert_ids(ids=GLOBAL):
> if ids is GLOBAL:
> ids = get_global_ids()
The one disadvantage of this approach is that it complicates pickling
if/when you store the stentinel in an instance. There are ways of
working around that, but none are pleasant.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"If you don't know what your program is supposed to do, you'd better not
start writing it." --Dijkstra