Serhiy Storchaka added the comment:

I just don't know well the purpose of sentinels, and don't . I see fourth 
possible options:

1. Raise an exception when copy or pickle a sentinel. This is an option when we 
want to be sure that copying and pickling are not involved and we get the same 
object as passed.

2. Create an unique sentinel with unique unambiguous name when copy or unpickle 
a sentinel. This is a behavior of commonly used sentinels (object(), 
['sentinel'], etc), and current behavior of mock.sentinel (except that the name 
is left the same and this is confusing).

3. Preserve identity when copy or pickle/unpickle a sentinel. This is an option 
when test a function that uses multiprocessing or persistent cache and should 
restore an equivalent object. This is a behavior of enums, classes, functions 
or other global named objects.

4. Preserve equality but not identity when copy or pickle/unpickle a sentinel. 
This is similar to the third option.

All options look reasonable to me. I don't know what case is more common, what 
behavior is more expectable.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20804>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to