Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

It's not hard to admit errors that are [only] cosmetically wrong. -- J. K. Galbraith


devel / comp.lang.python / Re: Imports and dot-notation

SubjectAuthor
o Re: Imports and dot-notationMats Wichmann

1
Re: Imports and dot-notation

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

  copy mid

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

  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: mat...@wichmann.us (Mats Wichmann)
Newsgroups: comp.lang.python
Subject: Re: Imports and dot-notation
Date: Thu, 10 Aug 2023 08:45:31 -0600
Lines: 18
Message-ID: <mailman.230.1691678742.23016.python-list@python.org>
References: <5f4f8962-08e6-ed0a-8c44-e83a2b10e0ba@schinagl.nl>
<749cae90-dc17-7f4a-2c03-b87394134d28@DancesWithMice.info>
<fbb1673f-f23c-e716-39b9-33b3e90a90db@wichmann.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de TZkEBfQVzJYR4HV5y8lD/QaX+tH5y7VVuN9UZIJL1Cpg==
Cancel-Lock: sha1:tRyRBAzCTtJxfeyCGTh9ZcTsUVY= sha256:U+m2XR7xmOff2EK7tuvF4PS3qmUizjXNsU4jxntYo0g=
Return-Path: <mats@wichmann.us>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=pobox.com header.i=@pobox.com header.b=tR8UMQrK;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.057
X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'loop': 0.07; 'lookup':
0.09; 'namespace': 0.09; 'import': 0.15; '"c"': 0.16; '"import':
0.16; 'received:64.147': 0.16; 'spending': 0.16; 'things,': 0.16;
'wrote:': 0.16; 'python': 0.16; 'to:addr:python-list': 0.20;
'run': 0.23; 'local': 0.27; 'wrong': 0.28; 'header:User-Agent:1':
0.30; 'whole': 0.30; 'module': 0.31; 'python-list': 0.32; 'but':
0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'cases': 0.36;
'using': 0.37; 'received:192.168': 0.37; 'least': 0.39; 'finding':
0.39; 'skip:o 10': 0.61; 'our': 0.64; 'thus': 0.64; 'received:64':
0.67; 'note:': 0.71; 'little': 0.73; 'relevant': 0.73; 'finds':
0.76; 'tight': 0.76; 'attribute': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id
:date:mime-version:subject:to:references:from:in-reply-to
:content-type:content-transfer-encoding; s=sasl; bh=BCc70E1av+Wa
Zd91q2VhSwLYzu8Gck6AXIlYUwHF8hw=; b=tR8UMQrK3QbDq6fRVZNwfGEWWI7t
GA02B/Wf8q9oNDJPIp/vS0qdMQm5oTAqcRapnH/1WcE9OSVl5N5XSRySDgcnzWxy
i5rNrYXBZxGa5YshUJOe5pnYEwayW8w18X1+Jxkk1OoL67NswFWCNFlBYTnRxNZ/
/bAWhrIcYOsnHTk=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=wichmann.us;
h=message-id:date:mime-version:subject:to:references:from:in-reply-to:content-type:content-transfer-encoding;
s=2018-07.pbsmtp; bh=BCc70E1av+WaZd91q2VhSwLYzu8Gck6AXIlYUwHF8hw=;
b=ZDnt38euVW/baIMLdXKXfJeKADugiAIeFfPYqU5CrU8+/y8zEe35u46B/m4GziBzgcS6KswIhueKm2GM+ZotFOCu4e3D8MrUeaesv3AQEFEvuQdd7ObdY9XDgVu+FXG1yQM/VkNyowc1XpRG01fUufqVZcjciif68EOYN5rCTS0=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Content-Language: en-US
In-Reply-To: <749cae90-dc17-7f4a-2c03-b87394134d28@DancesWithMice.info>
X-Pobox-Relay-ID: 8F21F3F2-378C-11EE-B46D-C65BE52EC81B-81526775!pb-smtp1.pobox.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: <fbb1673f-f23c-e716-39b9-33b3e90a90db@wichmann.us>
X-Mailman-Original-References: <5f4f8962-08e6-ed0a-8c44-e83a2b10e0ba@schinagl.nl>
<749cae90-dc17-7f4a-2c03-b87394134d28@DancesWithMice.info>
 by: Mats Wichmann - Thu, 10 Aug 2023 14:45 UTC

On 8/9/23 17:28, dn via Python-list wrote:

> Side note: Using "...import identifier, ..." does not save storage-space
> over "import module" (the whole module is imported regardless, IIRC),
> however it does form an "interface" and thus recommend leaning into the
> "Interface Segregation Principle", or as our InfoSec brethren would say
> 'the principle of least privilege'. Accordingly, prefer "from ... import
> ... as ...".
>

Attribute lookup has *some* cost. That is, finding "c" in the local
namespace is going to be a little quicker than "b.c", where Python finds
"b" in the local namespace and then finds its "c" attribute; that's then
a little quicker than "a.b.c", etc.

See all relevant commentary about premature optimisation, spending time
optimising the wrong things, etc. but there *are* cases where it
matters (c.f. a tight loop that will be run many many times)

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor