[Lldb-commits] [PATCH] D114156: [lldb/test] Add ability to terminate connection from a gdb-client handler
Michał Górny via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 18 10:07:08 PST 2021
mgorny added inline comments.
================
Comment at: lldb/packages/Python/lldbsuite/test/gdbclientutils.py:89
packetLog = None
+ RESPONSE_DISCONNECT = object()
----------------
labath wrote:
> mgorny wrote:
> > How about making it a class instead? It should make debugging easier, if it ever comes to that.
> >
> > ```
> > In [6]: RESPONSE_DISCONNECT = object()
> >
> > In [7]: RESPONSE_DISCONNECT
> > Out[7]: <object at 0x7f406dd328e0>
> >
> > In [8]: class RESPONSE_DISCONNECT: pass
> >
> > In [9]: RESPONSE_DISCONNECT
> > Out[9]: __main__.RESPONSE_DISCONNECT
> > ```
> I wouldn't call myself an expert on idiomatic python, but I was under the impression this is how one is expected to do these things <https://python-patterns.guide/python/sentinel-object/> (?)
Well, I see both versions in CPython stdlib but the advantage of using a class is that it gives clear `repr()` rather than identifying as an arbitrary `object`. You can also create an object of the sentinel class ;-).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114156/new/
https://reviews.llvm.org/D114156
More information about the lldb-commits
mailing list