Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Stinginess with privileges is kindness in disguise. -- Guide to VAX/VMS Security, Sep. 1984


devel / comp.lang.python / Re: fCONV_AUSRICHTG is not defined - Why?

SubjectAuthor
o Re: fCONV_AUSRICHTG is not defined - Why?Egon Frerich

1
Re: fCONV_AUSRICHTG is not defined - Why?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder2.eternal-september.org!eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: ego...@frerich.eu (Egon Frerich)
Newsgroups: comp.lang.python
Subject: Re: fCONV_AUSRICHTG is not defined - Why?
Date: Wed, 8 Nov 2023 09:24:18 +0100
Lines: 79
Message-ID: <mailman.206.1699432333.3828.python-list@python.org>
References: <e341ea45-5d8b-da2a-00a1-c2a4c65386de@frerich.eu>
<a5ac87ee-81ad-4b9f-a05e-14bb903671a7@DancesWithMice.info>
<b50dc492-90e3-401a-8d62-b0911c459f7c@mrabarnett.plus.com>
<eb281679-73a4-934f-9b75-92892e1c519a@frerich.eu>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de UoYTC55QM2+VxLP7tQbbtg6RqDwqXXJ4cWZhsHB57nBg==
Cancel-Lock: sha1:8mOJSg9n/x9PGLeJ7n+qE6S4nL8= sha256:tHmynO5KX5q/PYpdftTXy43R+/y16tOVyd1Ui67ZGQc=
Return-Path: <egon@frerich.eu>
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=frerich.eu header.i=@frerich.eu header.b=JsBaiDOn;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'traceback': 0.04; '(most':
0.05; 'last):': 0.05; 'class.': 0.07; 'subject:Why': 0.07;
'utf-8': 0.07; '(python': 0.09; 'happens.': 0.09; 'schrieb': 0.09;
'skip:\xc2 20': 0.09; 'subject:not': 0.09; 'import': 0.15; '-*-':
0.16; 'definitions': 0.16; 'encoding:': 0.16; 'python3.': 0.16;
'right.': 0.16; 'script,': 0.16; 'subject:skip:f 10': 0.16;
'wrote:': 0.16; 'to:addr:python-list': 0.20; "i've": 0.22;
'received:de': 0.23; 'idea': 0.24; '11,': 0.26; '>>>': 0.28;
'header:User-Agent:1': 0.30; 'module': 0.31; 'extract': 0.32;
'python-list': 0.32; 'but': 0.32; 'there': 0.33; 'header:In-Reply-
To:1': 0.34; 'header:Received:8': 0.36; 'change': 0.36; 'lists':
0.37; 'missing': 0.37; "skip:' 10": 0.37; 'class': 0.37;
'received:192.168': 0.37; 'file': 0.38; 'list': 0.39; 'both':
0.40; 'something': 0.40; 'detail': 0.61; 'skip:\xc2 10': 0.62;
'in:': 0.64; 'shows': 0.67; 'outside': 0.67; 'rules': 0.70;
'8bit%:100': 0.76; 'implemented': 0.76; 'happens': 0.84; 'scope':
0.84; 'skip:" 50': 0.84; '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=frerich.eu; s=DKIM001;
t=1699431860;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references;
bh=dw1T7pKCNvP9VFrWKyUYg82G6NuqZSS1RArvv4wIEVo=;
b=JsBaiDOn8fTWGammicvduNr2rpwm1F10I7KotEntaaMVAyeP+PBAP97ZnVHdmR0tD+f6QC
ohhe4u1gFx/TXYeFntceDsaZumGVX/sbceRx+zIAYobSLOuC0nd/PHonAZsV2BOSiaqMFY
JYMtHO5c7CtZY5kuR7h9c85pqrlI3YeTTXZwIPO+hvwl5L+1K/L84Pf82fRZPh7OZFu62w
Zf0ah4Z6hgNYO2wXo5cI+Y5T70a1DPUMAr8RR11EAdJtGzeV6dAB8pteHj3r8Bwd/bKJkE
+y+LEgWSTx+mEqoCHeJ2QUa+mjGJV1Fm4+MbjGj8L4zwzYGtPC0HlP7BXbL2Cw==
X-Virus-Scanned: Debian amavisd-new at hera.vankin.de
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
In-Reply-To: <b50dc492-90e3-401a-8d62-b0911c459f7c@mrabarnett.plus.com>
Content-Language: en-US
X-Rspamd-UID: 24ace2
X-Rspamd-UID: 74e551
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: <eb281679-73a4-934f-9b75-92892e1c519a@frerich.eu>
X-Mailman-Original-References: <e341ea45-5d8b-da2a-00a1-c2a4c65386de@frerich.eu>
<a5ac87ee-81ad-4b9f-a05e-14bb903671a7@DancesWithMice.info>
<b50dc492-90e3-401a-8d62-b0911c459f7c@mrabarnett.plus.com>
 by: Egon Frerich - Wed, 8 Nov 2023 08:24 UTC

Am 07.11.23 um 20:10 schrieb MRAB via Python-list:
> On 2023-11-07 18:30, dn via Python-list wrote:
>> On 08/11/2023 06.47, Egon Frerich via Python-list wrote:
>>> I've no idea why this happens. In a module there are lists and
>>> definitions:
>> ...
>>
>>>      ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in
>>> Felder])
>>>    File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line
>>> 90, in <listcomp>
>>>      ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in
>>> Felder])
>>> NameError: name 'fCONV_AUSRICHTG' is not defined
>>>
>>> You see "Felder" and with "0 0 3 4" the correct value 4 for
>>> fCONV_AUSRICHTG. But there is the NameError.
>>>
>>> What does <listcomp> mean? Is there a change from python2 to python3?
>>
>> Works for me (Python 3.11 on Fedora-Linux 37)
>> - both as a script, and simple/single import.
>>
>> What happens when you extract the second dimension's definitions into a
>> module of their own, and import that (with/out less-sophisticated join)?
>>
> The missing detail is this line from the traceback:
>
>    File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konfig.py", line 11,
> in <module>
>      class GUIcfg:
>
You are right. The list comprehension has to be outside the class. The
scope rules have been changed python2 and python3.

Egon

> Here's a small example that shows the problem:
>
> ----8<----
> #!python3.11
> # -*- encoding: utf-8 -*-
>
> class Test:
>     hello = "hello"
>     print(hello)
>     print([[zero] for _ in range(4)])
> ----8<----
>
> and its traceback:
>
> ----8<----
> hello
> Traceback (most recent call last):
>   File "C:\Projects\regex3\test_clipboard.py", line 4, in <module>
>     class Test:
>   File "C:\Projects\regex3\test_clipboard.py", line 7, in Test
>     print([zero for _ in range(4)])
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "C:\Projects\regex3\test_clipboard.py", line 7, in <listcomp>
>     print([zero for _ in range(4)])
>            ^^^^
> NameError: name 'zero' is not defined
> ----8<----
>
> 'zero' is visible in:
>
>     print(hello)
>
> but not in:
>
>     print([zero for _ in range(4)])
>
> Something to do with how scoping is implemented in comprehensions?
>

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor