Thanks Tal for writing this up.
A couple comments:
1) “Add a single new sentinel value, e.g. MISSING or Sentinel” (under
rejected)
I was one of the proponent of that -- but not as an alternative to having a
stadardars way to create unique sentinels, but as an addition. That's kind
of orthogonal
Here is a simple implementation of that Sentinel class:
https://github.com/fluentpython/example-code-2e/blob/master/25-class-metaprog/sentinel/sentinel.py
Tests in the same directory. That's not a real package yet, just a
couple of super simple examples I may use in Fluent Python 2e.
Cheers,
Lu
On 2021-05-24 01:37, Luciano Ramalho wrote:
Sorry about my detour into the rejected idea of a factory function.
But how about this class-based API?
class NotGiven(Sentinel):
pass
Now I can use NotGiven as the sentinel, and its default repr is .
The repr of other singletons are the names
Sorry about my detour into the rejected idea of a factory function.
But how about this class-based API?
class NotGiven(Sentinel):
pass
Now I can use NotGiven as the sentinel, and its default repr is .
Behind the scenes we can have a SentinelMeta metaclass with all the
magic that could be r
On Sun, May 23, 2021 at 3:37 AM Tal Einat wrote:
> I put up an early draft of a PEP on a branch in the PEPs repo:
> https://github.com/python/peps/blob/sentinels/pep-.rst
Thanks for that PEP, Tal. Good ideas and recap there.
I think repr= should have a default: the name of the class within <
> Just turn off optimisation when you want to single-step.
But I don't just want to single-step. I want to break at the target
label associated with a specific opcode. (I am - in fits and starts -
working on register-based virtual machine instructions). If I'm
working on, for example, the register
On 2021-05-23 14:56, Skip Montanaro wrote:
I strongly suggest to only build Python with -O0 when using gdb. -Og
enables too many optimizations which makes gdb less usable.
Thanks, Victor. It never made sense to me that you would want any
optimizations enabled when truly debugging code (as oppos
> I strongly suggest to only build Python with -O0 when using gdb. -Og
> enables too many optimizations which makes gdb less usable.
Thanks, Victor. It never made sense to me that you would want any
optimizations enabled when truly debugging code (as opposed to wanting
debug symbols and a sane tra