Raymond Hettinger added the comment:

-0 I concur with OP's observation that "object() returns a new unique value 
while conveying that that value should not be expected to be used in any 
meaningful way" and that this recipe could help reinforce that notion.  That 
said, the idiomatic way to communicate this in Python is to use None rather 
than to create distinct meaningless objects.

Also, the motivation seems questionable.  Instead of showing a real world case 
where some confusion exists, there seems to be a general irritation that Enum 
implementation details differ in some respects from various compiled languages. 
 ISTM, the recipe is aimed at an imagined problem rather than an actual problem 
-- in a real use case (not a toy Color example), I would expect that if the 
value field is meaningless, then the use case itself will tend to make it 
self-evident that there is no reason to access the value field (and if it 
didn't, I don't see how returning some arbitrary instance of object() would be 
more informative than returning None.)

----------
nosy: +rhettinger

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

Reply via email to