Does everyone use 's `object()` for unique tokens? Like:

```
no_match = object()

val = some_dict.get('key', no_match)

if val is not no_match:

do_something()
```

I don't know what else `object()` would be used for (and why they'd keep it).

@2ck I do that sometimes.
It's kind of a historical fact now, I guess? At some point in py2 there wasn't "object" and then there was and you could opt-in to "new-style classes" with `class Foo(object):`. In py3 everything is new-style. IIRC ;)
#python

Follow

@meejah yeah, I mean specifically its use as a way to mint these sort-of do-nothing objects, not just its use as a type

@2ck I have certainly done that (and have seen it used).
There's also libraries like constantly.readthedocs.io/en/l for a similar use-case (but maybe .. a bit more "structured"?)
#python

@meejah that's kinda cool. If I ever used that though, I'd probably drop it the first chance I got in order to reduce dependencies. Would probably like it better as a code generation tool.

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.