Sorry for having conflated the core of the matter with all
the Borg shenanigans, that's where I found the problem in my
real code, so there :-)
Consider this:
#
class Surprise:
def __init__(self, with_type_annotation=False):
On Sun, 1 Oct 2023 at 22:58, Karsten Hilbert via Python-list
wrote:
>
> Sorry for having conflated the core of the matter with all
> the Borg shenanigans, that's where I found the problem in my
> real code, so there :-)
>
> Consider this:
>
> #
>
My view of the issue is that the "trick" of "evaluating" a name to see
if the object has been initialized is just a tad on the "tricky" side,
and the annotation/value is really incorrect.
The name at the point you are annotating it, isn't really a "bool"
because a bool will always have either
> On 1 Oct 2023, at 19:36, Richard Damon via Python-list
> wrote:
>
> Perhaps a better method would be rather than just using the name and catching
> the exception, use a real already_initialized flag (set to True when you
> initialize), and look it up with getattr() with a default value of
On Mon, 2 Oct 2023 at 09:10, Barry via Python-list
wrote:
>
>
>
> > On 1 Oct 2023, at 19:36, Richard Damon via Python-list
> > wrote:
> >
> > Perhaps a better method would be rather than just using the name and
> > catching the exception, use a real already_initialized flag (set to True
> > wh