Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

6 May, 2024: The networking issue during the past two days has been identified and appears to be fixed. Will keep monitoring.


devel / comp.lang.python / Re: learning python ...

SubjectAuthor
o Re: learning python ...MRAB

1
Re: learning python ...

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: pyt...@mrabarnett.plus.com (MRAB)
Newsgroups: comp.lang.python
Subject: Re: learning python ...
Date: Sun, 23 May 2021 20:58:58 +0100
Lines: 72
Message-ID: <mailman.282.1621800128.3087.python-list@python.org>
References: <143d4163-faf5-3794-095d-f28e85a18c58@adminart.net>
<s8e3bn$105v$1@ciao.gmane.io>
<6730da2c-1440-ad59-7494-b5ce5b5bccae@adminart.net>
<5627423f-267d-9c01-3d61-5c67f5d192d2@mrabarnett.plus.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de d3CHpghBIzlr3EDOjpdCIAroCm4UJWs7P+mbRws1OhDg==
Return-Path: <python@mrabarnett.plus.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=plus.com header.i=@plus.com header.b=OjpjD03f;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(which': 0.04;
'traceback': 0.04; '(most': 0.05; 'last):': 0.05; 'variable':
0.05; 'subject:python': 0.06; 'float': 0.07; '18,': 0.09;
'apparently': 0.09; 'from:addr:python': 0.09; 'int': 0.09;
'received:192.168.1.64': 0.09; 'smaller': 0.09; 'typeerror:':
0.09; 'types.': 0.09; '18.': 0.16; 'float,': 0.16;
'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16;
'int)': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'naming':
0.16; 'received:plus.net': 0.16; 'something.': 0.16; 'tuple':
0.16; 'wrote:': 0.16; 'that.': 0.16; 'python': 0.16; 'instead':
0.17; 'bug': 0.20; 'calls': 0.20; 'pm,': 0.20; 'version': 0.22;
'to:addr:python-list': 0.23; 'code': 0.24; 'idea': 0.25; '>>>':
0.26; 'seems': 0.26; 'creating': 0.27; 'function': 0.28; "i'll":
0.28; 'error': 0.28; 'header:User-Agent:1': 0.31; 'it,': 0.31;
'received:192.168.1': 0.31; 'think': 0.31; 'but': 0.31; "doesn't":
0.32; "i'm": 0.32; '"",': 0.32; 'else,': 0.32; 'program': 0.33;
'header:In-Reply-To:1': 0.33; 'following': 0.35; 'running': 0.35;
'yes,': 0.35; 'received:192.168': 0.37; 'file': 0.38; "it's":
0.38; 'something': 0.38; 'put': 0.39; 'hi,': 0.39; 'whether':
0.40; 'example': 0.40; '\xc2\xa0\xc2\xa0': 0.63; 'types': 0.63;
'skip:# 10': 0.64; 'your': 0.64; 'care': 0.67; 'bad': 0.68;
'received:212': 0.68; 'etc,': 0.69; 'refers': 0.69; 'little':
0.75; 'type,': 0.84; '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plus.com; s=042019;
t=1621799940; bh=NP0vus5vIhzKfD2QVO3sj3kz7EnsHwLobNGt+NEXVuw=;
h=Subject:To:References:From:Date:In-Reply-To;
b=OjpjD03fwGtRdpvc4kiZTSWHJ5q2+z1OalS15Je720bO6E6zQBAvdaQn11L8+Mmu5
WwoxoaJLC+gyiRyhBRljFG2npt/Ld4H3efmdRnOFBJ0R5TblLEyMugCV/BL/rmfWQx
iqieCs0iMG9VFglb3fawc1wUoGUsN0k3y68FkCtMvief+OglHhOAYt0COwPzyXXYf+
QDHBVk4S5AjL21dCx8CmXMEQwH7iWt3cHD57tHe9t5lvXkfAoo/Wqm4ncGQ5xNbng2
dXz1IfFXhcUc8TMT69216uYpq046i793n3EU4WWf38X7un8egGsKkQzZla5KQ6Tn6w
3qzvzyunKHdKw==
X-Clacks-Overhead: "GNU Terry Pratchett"
X-CM-Score: 0.00
X-CNFS-Analysis: v=2.3 cv=IvmFjI3g c=1 sm=1 tr=0
a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17
a=IkcTkHD0fZMA:10 a=aLhkngQ4A80NLBmY1fIA:9 a=QEXdDO2ut3YA:10
X-AUTH: mrabarnett@:2500
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.10.2
In-Reply-To: <6730da2c-1440-ad59-7494-b5ce5b5bccae@adminart.net>
Content-Language: en-GB
X-CMAE-Envelope: MS4wfGYmm1K3Ww4VkB7ispSrZCPxZZR3WsJd5t9afCJ33S3z8lP/v0rgi3oSZy6xjz90dy1RHmOVEwEpszxNpn9Xs2m0Mdk6GLLA04mQjtlJTfuXkBZ4S5cR
oYNkQum7RPzI1iVM42+IQf3jhYAMuYiP4Iw+Ys4vkyqSeM2tRM2q45rImC1yfeuEXPYThwgsQTIIbg==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
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: <5627423f-267d-9c01-3d61-5c67f5d192d2@mrabarnett.plus.com>
X-Mailman-Original-References: <143d4163-faf5-3794-095d-f28e85a18c58@adminart.net>
<s8e3bn$105v$1@ciao.gmane.io>
<6730da2c-1440-ad59-7494-b5ce5b5bccae@adminart.net>
 by: MRAB - Sun, 23 May 2021 19:58 UTC

On 2021-05-23 20:34, hw wrote:
> On 5/23/21 7:28 PM, Peter Otten wrote:
>> On 23/05/2021 06:37, hw wrote:
>>>
>>> Hi,
>>>
>>> I'm starting to learn python and have made a little example program
>>> following a tutorial[1] I'm attaching.
>>>
>>> Running it, I'm getting:
>>>
>>>
>>> Traceback (most recent call last):
>>>    File "[...]/hworld.py", line 18, in <module>
>>>      print(isinstance(int, float))
>>> TypeError: isinstance() arg 2 must be a type or tuple of types
>>>
>>>
>>> I would understand to get an error message in line 5 but not in 18.
>>> Is this a bug or a feature?
>>
>> It is a bug in your code (which you don't provide). Did you assign some
>> value to float, e. g.:
>>
>> >>> float = 42.0
>> >>> isinstance(int, float)
>> Traceback (most recent call last):
>>   File "<pyshell#313>", line 1, in <module>
>>     isinstance(int, float)
>> TypeError: isinstance() arg 2 must be a type or tuple of types
>>
>> If you do not shadow the built-in you should get
>>
>> >>> isinstance(int, float)
>> False
>>
>
> Apparently the attachment was stripped from my message. I'll put a
> smaller version directly into this message instead of an attachment:
>
>
> #!/usr/bin/python
>
> print("world!")
>
> int = 17
> print("world", int)
>
> float = 6.670
> print("world", float)
>
> foo = 0
> print(type(int))
> print(type(float))
> print(type(foo))
>
> print(isinstance(foo, str))
> print(isinstance(int, float))
> print(isinstance(float, float))
>
>
> I don't know about shadowing. If I have defeated a whole variable type
> by naming a variable like a variable type, I would think it is a bad
> idea for python to allow this without warning. It seems like a recipie
> for creating chaos.
>
The example you're following calls the variables "myfloat", etc, not
"float", etc, so, yes, you're hiding the names of the types. Don't do that.

As far as Python is concerned, it's just a name that refers to
something. It doesn't care whether that something is a type or a
function or something else, it's just a name that refers to something.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor