Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A man is not complete until he is married -- then he is finished.


devel / comp.lang.python / Re: type annotation vs working code

SubjectAuthor
o Re: type annotation vs working codeBarry

1
Re: type annotation vs working code

<mailman.379.1696198151.23016.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=24092&group=comp.lang.python#24092

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: bar...@barrys-emacs.org (Barry)
Newsgroups: comp.lang.python
Subject: Re: type annotation vs working code
Date: Sun, 1 Oct 2023 23:08:52 +0100
Lines: 19
Message-ID: <mailman.379.1696198151.23016.python-list@python.org>
References: <46b06982-0a90-411f-85b7-72fd9b8af1c8@Damon-Family.org>
<26FEAE70-0719-4D92-9174-7DC2B83F8FE1@barrys-emacs.org>
Mime-Version: 1.0 (1.0)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de ZDx8NMpjZ2jWL4F58LR8tw9d3anXMAX/+I+lQQ47SpAw==
Cancel-Lock: sha1:GFazMRhZIE4qJppXLoFgtE8PmqM= sha256:2JoZo0B1o1w8GRAAyVYIu0PFLg9iqZzWT8LBHtbmyRg=
Return-Path: <barry@barrys-emacs.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'def': 0.04; 'variable':
0.05; 'cc:addr:python-list': 0.09; 'damon': 0.09;
'from:addr:barry': 0.09; 'received:217.70': 0.09;
'received:gandi.net': 0.09; 'received:mail.gandi.net': 0.09;
'cc:no real name:2**0': 0.14; 'assert': 0.16; 'barry': 0.16;
'false.': 0.16; 'flag': 0.16; 'from:addr:barrys-emacs.org': 0.16;
'instance': 0.16; 'message-id:@barrys-emacs.org': 0.16;
'subject:code': 0.16; 'subject:working': 0.16; 'variable.': 0.16;
'wrote:': 0.16; 'cc:addr:python.org': 0.20; 'skip:_ 10': 0.22;
'cc:2**0': 0.25; 'default': 0.31; 'python-list': 0.32; 'header:In-
Reply-To:1': 0.34; 'using': 0.37; 'class': 0.37; 'use': 0.39;
'method': 0.61; 'skip:o 20': 0.63; 'true': 0.63; 'richard': 0.64;
'look': 0.65; 'received:217': 0.67; 'catching': 0.84;
'to:addr:richard': 0.84; 'subject:type': 0.91
In-Reply-To: <46b06982-0a90-411f-85b7-72fd9b8af1c8@Damon-Family.org>
X-Mailer: iPad Mail (21A351)
X-GND-Sasl: barry@barrys-emacs.org
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <26FEAE70-0719-4D92-9174-7DC2B83F8FE1@barrys-emacs.org>
X-Mailman-Original-References: <46b06982-0a90-411f-85b7-72fd9b8af1c8@Damon-Family.org>
 by: Barry - Sun, 1 Oct 2023 22:08 UTC

> On 1 Oct 2023, at 19:36, Richard Damon via Python-list <python-list@python..org> 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 False.
I would use a class variable not an instance variable.

class OnlyOne:
sole_instance = None
def __init__(self):
assert OnlyOne.sole_instance is None
OnlyOne.sole_instance = self

Barry

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor