Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Whip me. Beat me. Make me maintain AIX." (By Stephan Zielinski)


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

SubjectAuthor
o Re: type annotation vs working codeRichard Damon

1
Re: type annotation vs working code

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

  copy mid

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

  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: Richard@Damon-Family.org (Richard Damon)
Newsgroups: comp.lang.python
Subject: Re: type annotation vs working code
Date: Sun, 1 Oct 2023 14:33:21 -0400
Lines: 16
Message-ID: <mailman.378.1696185209.23016.python-list@python.org>
References: <ZRhwWN29i3mskxEL@hermes.hilbert.loc>
<ecc36615-1844-455f-b701-2bd41d98e9e1@DancesWithMice.info>
<ZRigRwHpNReUo5rF@hermes.hilbert.loc>
<4f1c9568-3850-4847-b357-740f79b0a79b@DancesWithMice.info>
<ZRlelmUwOR/wcPqR@hermes.hilbert.loc>
<46b06982-0a90-411f-85b7-72fd9b8af1c8@Damon-Family.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de gMmth3AXfsDZc5IIzXgpDQxxCIcKMDfGH49FxEXm6yCQ==
Cancel-Lock: sha1:zufiZEzLmH2tU+WqSTP3O0AkrWQ= sha256:ggDJL7AlpwSLbMuuZ4lTle4KqPbK8fAagdejO+O8P3A=
Return-Path: <Richard@Damon-Family.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.069
X-Spam-Evidence: '*H*': 0.87; '*S*': 0.01; 'damon': 0.09; 'false.':
0.16; 'flag': 0.16; 'from:addr:damon-family.org': 0.16;
'from:addr:richard': 0.16; 'from:name:richard damon': 0.16;
'message-id:@Damon-Family.org': 0.16; 'received:74.208.4.194':
0.16; 'subject:code': 0.16; 'subject:working': 0.16; 'variable,':
0.16; 'to:addr:python-list': 0.20; 'issue': 0.21; 'object': 0.26;
"isn't": 0.27; 'it,': 0.29; 'header:User-Agent:1': 0.30;
'default': 0.31; 'header:In-Reply-To:1': 0.34; 'really': 0.37;
'using': 0.37; 'received:192.168': 0.37; 'use': 0.39; 'view':
0.60; 'method': 0.61; 'true': 0.63; 'richard': 0.64; 'look': 0.65;
'"trick"': 0.84; 'catching': 0.84; 'exists': 0.91; 'subject:type':
0.91
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <ZRlelmUwOR/wcPqR@hermes.hilbert.loc>
X-Provags-ID: V03:K1:09H3uOCHIWVWR9gi76WrfF5HO3LB9Tp5N1B/42PTVf5gCOrax6o
edNB4lukP5gK46n5xr23HaQreR/4EkHCAVWDCv+j57Ja6EOU7zGupUuvm6TVwgooB/MtGsq
uTLOWj4TJJwv7cpegKlNn3iRHqoVvYDH0ndwSzfC/6X5INbH942lnFcC2FjpQ8nuLRxFC56
AYhsLbfJfu/FFtC2StvAw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:H0FTfwq7t5A=;C99jt+iSwFkB432FoN1dQzbSsqv
IFHuGRLnH23EdyA2BXBDZgXHiISdFY+D39qFphm5jxlp97JQZBHotNsNhDCKqYnhysDa6qn4+
zRUNid2rNvBeX4vtxwzIIi3hWy1MQTVD769Tq6usadtrABOUZBSGa6ofs5oarvNVbQ1kJ+/Jz
pdxL0WO0FFyxtB0ItLCHLf0k5URzD4s/0AbdjNRS34IdbPywyhuhR/x55Yw4EOAh/gfvEX1wL
Q7TFcLPnm4fTr+rzvepWm+ArvIZFTwvbbB4vyRCjsY54zItH9os1S9KVSbhZW69LFH0pnmMPY
MyZ/fN4Wr+T/cK17BmbgxQDns1U7ZbDUqITiV6ThJwre50HLmBlvbgea4vjQEf2Mx8pyo5m2i
5iwSrt7JZUokUzIMtL7T8/YUB2WaAp7fnWK3qgSn+k3f3GRdDWTARjjU1gI1fzBMaRP7ZftiG
R1bTAlZ2PngDYORuWyrMz5u30dAqBXz9wjx3HFCYpyoXMduevBki3l4HlijoItgJWyURH7EsT
IgjetUdQpKI6SKsWgbu8YpXW4a6hrOGfepGDnIGEZwfbDkyZZ3DB3hH31SiV94MR5BSIgrCdo
32uvssgHYdJWyZu+AdSe3vBocnZ+uTbLUeX5Eouwjv12BGr+WmkQUv9EkPhgmeFU0yOG3qbjL
dYyuBkQ5drvmLwVcUfO6ttIOhp7yTGR8C9UBTL4dQTw378so7piP6/seMa0A7FWO3+CGKJfvz
K6aYyvnEJkp957Mh9kcEAr8hVN/ei7OJ2AaRrwIJh4jnIJee/8pvbRi7yyZvbdbLXCPbPIE1J
GHgxt/ddqMETrV2uqLOUQ3l1/GbkGgnwPsE6FwWW1d885qpHaQ6s09laFrXgX/Aaj/X1eOKN2
s7I6CJs428rpKeA==
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: <46b06982-0a90-411f-85b7-72fd9b8af1c8@Damon-Family.org>
X-Mailman-Original-References: <ZRhwWN29i3mskxEL@hermes.hilbert.loc>
<ecc36615-1844-455f-b701-2bd41d98e9e1@DancesWithMice.info>
<ZRigRwHpNReUo5rF@hermes.hilbert.loc>
<4f1c9568-3850-4847-b357-740f79b0a79b@DancesWithMice.info>
<ZRlelmUwOR/wcPqR@hermes.hilbert.loc>
 by: Richard Damon - Sun, 1 Oct 2023 18:33 UTC

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 the value "True" or "False",
while for this variable, you are really testing if it exists or not.

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.

--
Richard Damon


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

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor