In article <[EMAIL PROTECTED]>,
Ben Finney  <[EMAIL PROTECTED]> 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 ([EMAIL PROTECTED])           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to