Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

It's time to boot, do your boot ROMs know where your disk controllers are?


devel / comp.lang.python / Re: A Single Instance of an Object?

SubjectAuthor
o Re: A Single Instance of an Object?Ivan \"Rambius\" Ivanov

1
Re: A Single Instance of an Object?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: rambiusparkisanius@gmail.com (Ivan \"Rambius\" Ivanov)
Newsgroups: comp.lang.python
Subject: Re: A Single Instance of an Object?
Date: Mon, 11 Mar 2024 17:04:32 -0400
Lines: 28
Message-ID: <mailman.88.1710191087.3452.python-list@python.org>
References: <CAE9rwzOnEiBSf_m19EQByXQ_Qyk=GkiEzBUf=WMfaeZvR9102g@mail.gmail.com>
<CAPTjJmoNiGMt2BiUBkY52j9O3ATL=izAb1uu00s2hLKp-1_szw@mail.gmail.com>
<CAE9rwzO1AQqLWYbHfujNkrPC4qbCCVgNtTopE=iZtUZ_GS2hDw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de Fc8Ki60j7JFL7Y/VZiQ6SAgqLSH/1XElFLNZzQU7zUhw==
Cancel-Lock: sha1:WNjPfGg8ipF51tUZUByYhrHlxhA= sha256:A2fQCT9rxoziLXpWcskcd19csMl18e3zAk9AE0c4J9k=
Return-Path: <rambiusparkisanius@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=YmYg+lIE;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.025
X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'mar': 0.07; 'angelico':
0.09; 'avoided': 0.09; 'cc:addr:python-list': 0.09; 'situations':
0.09; '2024': 0.16; 'cc:name:python': 0.16; 'modifies': 0.16;
'outline:': 0.16; 'received:mail-ed1-x52e.google.com': 0.16;
'refactoring': 0.16; 'variable.': 0.16; 'wrote:': 0.16; 'python':
0.16; 'tue,': 0.19; 'cc:addr:python.org': 0.20; 'code': 0.23;
'cc:2**0': 0.25; '11,': 0.26; 'done': 0.28; 'chris': 0.28;
'this?': 0.29; 'python-list': 0.32; 'message-id:@mail.gmail.com':
0.32; 'but': 0.32; 'someone': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'track': 0.35; 'from:addr:gmail.com':
0.35; 'mon,': 0.36; 'hard': 0.37; 'use': 0.39; 'tell': 0.60;
'here': 0.62; 'experience': 0.64; 'ivan': 0.64; 'bad': 0.67;
'global': 0.73; 'implemented': 0.76; 'mega': 0.84; 'rid': 0.84;
'url-ip:195/8': 0.84; 'deliberately': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1710191085; x=1710795885; darn=python.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=8qe2Jmx8dd+PjI80cUK6blvkGE0Uh8bxA0BepJVgDts=;
b=YmYg+lIEEIpfhWESuLlrG9VcRDke75uB5gtttjqpvyhHscCmAchIv+TQjPV/v7MObk
sGu8G3RguOB1xWBK5KfztjR+9sD5Fca34ZR5f0ScNPy20Dog+yfAXt2JZIDW4H3WydDV
vGQcwacLV2Fr+BpKL//ogjfc5IOAin6QxuMBriKTyWfGvt4gZaeWJmoGNxoiqZj7H5Jf
SRocPc4P3coHWygJa+ONzjMtTVCI+ReeYD1hPkamMMeckACKprI2W03tlC3/7CqrzUKK
AEYxyYybvo5FLJwOFBP94/5Iw9p69srrDrkaooYLNbYFs5OtF+qD1fQJe06TFQJCuZ9h
eEiQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1710191085; x=1710795885;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=8qe2Jmx8dd+PjI80cUK6blvkGE0Uh8bxA0BepJVgDts=;
b=b+SJ91pvnNZjW2u/n+Uu3TQw5bWMVluLog3BVjbLmtG0MSFEUFfFaBZegei03N1m6W
PdwsWmwtxj5GvHwy1TONXeGweI710LaLxts5Qes/QgIaTH/URG7dkAC2JFh2JLG+nmZ+
WJzuniMEwY2vvNvFjYtr8BkeWa0OUaDHu7AO0+nVEAe9Owsmpo6aBggrb9v7Z7/yTPWO
nSMvi+90yOIi7eBIsCjCy/dsvEvN/A9nxEqI6CJWBUxEFwzKT9z/FwIe7YV7IzKPMqMG
DrjzpHFeklH1npgyQVkJZngHag91DBI6kO0V3DeHebelrXIW9cXecKdCFYQOIJ16mD+x
tm6g==
X-Gm-Message-State: AOJu0YzinFgj188nuNU4hlEvKb60DtOwMpe50+IuXCIPgioqvlp08CQx
l9TB33gzVXBwI4H+Z/EXeDnGU/A2rFJd1Ll0MLkO2EDeX+vnK0AS6klbrmLJaGaWg3fCaqc/X7+
Ct7xwQnHuDO7Y5uS3DqdktBaFV/6IvDoU
X-Google-Smtp-Source: AGHT+IES5YWg5PR56GKRgIzB1f42LcmzuihAnhYwqEmkRvFWynSoZwBgceYc++0vvrSPKH+6mYb9+fXuQB2nXgiINXA=
X-Received: by 2002:a50:d59c:0:b0:568:1c64:277c with SMTP id
v28-20020a50d59c000000b005681c64277cmr5469600edi.15.1710191084881; Mon, 11
Mar 2024 14:04:44 -0700 (PDT)
In-Reply-To: <CAPTjJmoNiGMt2BiUBkY52j9O3ATL=izAb1uu00s2hLKp-1_szw@mail.gmail.com>
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: <CAE9rwzO1AQqLWYbHfujNkrPC4qbCCVgNtTopE=iZtUZ_GS2hDw@mail.gmail.com>
X-Mailman-Original-References: <CAE9rwzOnEiBSf_m19EQByXQ_Qyk=GkiEzBUf=WMfaeZvR9102g@mail.gmail.com>
<CAPTjJmoNiGMt2BiUBkY52j9O3ATL=izAb1uu00s2hLKp-1_szw@mail.gmail.com>
 by: Ivan \Rambius\ Ivano - Mon, 11 Mar 2024 21:04 UTC

On Mon, Mar 11, 2024 at 5:01 PM Chris Angelico via Python-list
<python-list@python.org> wrote:
>
> On Tue, 12 Mar 2024 at 07:54, Ivan "Rambius" Ivanov via Python-list
> <python-list@python.org> wrote:
> > I am refactoring some code and I would like to get rid of a global
> > variable. Here is the outline:
> >
> > ...
> >
> > I have never done that in Python because I deliberately avoided such
> > complicated situations up to now. I know about the Singleton pattern,
> > but I have never implemented it in Python and I don't know if it is
> > Pythonish.
> >
>
> A Singleton is just a global variable. Why do this? Did someone tell
> you "global variables are bad, don't use them"?

I have bad experience with global variables because it is hard to
track what and when modifies them. I don't consider them bad, but if I
can I avoid them.

Regards
rambius

--
Tangra Mega Rock: http://www.radiotangra.com

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor