• Aw: Re: Re: Re: Any possible type alias that can also set a default val

    From Karsten Hilbert@21:1/5 to All on Thu Oct 19 10:34:34 2023
    As per my recent foray into abusing existence-checking for Singleton assurance
    along such lines as

    try: self.initialized
    except AttributeError: print('first instantiation'); self.initialized = True

    and then changing that to

    try: self.initialized:bool

    But that's not equivalent code.

    I learned as much (RHS vs LHS).

    But it did not _intuitively_ resonate with the sentiment
    "type annotation does not change the running of code".

    Karsten

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)