Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Turn on, tune up, rock out." -- Billy Gibbons


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

SubjectAuthor
o Re: learning python ...Igor Korot

1
Re: learning python ...

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ikoro...@gmail.com (Igor Korot)
Newsgroups: comp.lang.python
Subject: Re: learning python ...
Date: Mon, 24 May 2021 00:34:16 -0500
Lines: 161
Message-ID: <mailman.289.1621834470.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>
<CACFDE8bsJe2BMNwsXAiGyxsMxNE+RuENj62GtfEzqodh5O_mMA@mail.gmail.com>
<5cec7f52-a66b-608c-4816-a3d8816658b2@adminart.net>
<CA+FnnTyLPWPz9Jt4LXSL0hhQ3n2UWgicX49RdTADqtFj9jcP5w@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 RopCsNAddv6mG/v1R30HqQ7e267BF4dSS2VZSK8/H1pg==
Return-Path: <ikorot01@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=XKY6A+ZZ;
dkim-adsp=pass; 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; 'debug': 0.07; 'float': 0.07;
'programmer': 0.07; 'sun,': 0.07; 'that?': 0.07; 'used.': 0.07;
'python.': 0.07; 'url:mailman': 0.09; '18,': 0.09; 'apparently':
0.09; 'cc:addr:python-list': 0.09; 'effectively': 0.09; 'int':
0.09; 'prints': 0.09; "shouldn't": 0.09; 'situations': 0.09;
'smaller': 0.09; 'typeerror:': 0.09; "can't": 0.14; '18.': 0.16;
'c++': 0.16; 'confusing.': 0.16; 'false.': 0.16; 'float,': 0.16;
'int)': 0.16; 'naming': 0.16; 'tuple': 0.16; 'wrote:': 0.16;
'syntax': 0.16; 'url:listinfo': 0.16; 'python': 0.16; 'instead':
0.17; 'figure': 0.18; 'cc:addr:python.org': 0.19; 'bug': 0.20;
'pm,': 0.20; 'url-ip:188.166.95.178/32': 0.20; 'url-
ip:188.166.95/24': 0.20; 'programming': 0.21; 'python,': 0.21;
'cc:2**1': 0.22; 'language': 0.22; 'version': 0.22; 'url-
ip:188.166/16': 0.23; "what's": 0.23; 'anyone': 0.23; 'code':
0.24; 'idea': 0.25; '>>>': 0.26; 'thinking': 0.26; 'seems': 0.26;
'creating': 0.27; 'wrong': 0.27; 'bit': 0.28; "i'll": 0.28;
'output': 0.28; 'saying': 0.28; 'error': 0.28; 'url-ip:188/8':
0.29; 'it,': 0.31; 'there': 0.31; 'think': 0.31; 'code,': 0.31;
'stuff': 0.31; 'but': 0.31; "doesn't": 0.32; "i'm": 0.32; '"",':
0.32; 'difference': 0.32; 'language.': 0.32; 'ton': 0.32;
'message-id:@mail.gmail.com': 0.33; 'program': 0.33; 'header:In-
Reply-To:1': 0.33; 'received:google.com': 0.34; 'example,': 0.35;
'following': 0.35; 'running': 0.35; 'from:addr:gmail.com': 0.35;
'trying': 0.36; 'cases': 0.37; 'recommend': 0.37; 'table': 0.37;
'way': 0.37; 'change': 0.37; '(or': 0.37; 'received:209.85': 0.38;
'file': 0.38; 'something': 0.38; 'received:209': 0.38; 'going':
0.38; 'use': 0.38; 'learning': 0.38; 'does': 0.38; 'put': 0.39;
'hi,': 0.39; 'whether': 0.40; 'example': 0.40; 'least': 0.40;
'built': 0.40; "skip:' 10": 0.40; 'days': 0.61; 'likely': 0.61;
'remember': 0.61; 'rules': 0.63; 'true': 0.63; 'types': 0.63;
'skip:# 10': 0.64; 'your': 0.64; 'his': 0.65; 'spend': 0.65;
'look': 0.66; 'bad': 0.68; 'changing': 0.69; 'highly': 0.70;
'you.': 0.70; 'easy': 0.75; 'little': 0.75; 'name,': 0.75;
'reasons': 0.75; 'database': 0.77; 'highlight': 0.77; 'supposed':
0.77; '2021': 0.84; 'dangerous': 0.84; '10:02': 0.84; 'creepy':
0.84; 'highlights': 0.84; 'received:209.85.216': 0.84; 'type,':
0.84; 'unwanted': 0.84; 'stopping': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc:content-transfer-encoding;
bh=UxGwlI/qgHXs4uW0kScMq9qRFg9ZKhK8Pr+5XEm5JXU=;
b=XKY6A+ZZWx/9IcCp7JyOgLtdMAvctnNLeUVGk4EzUt2dn1rz72I7dsXbQY8p2ics3H
S6+pbweQEgmoyVXuiiuc3aEpnSskOm6telmq9XFSAiQoVNAgJgv1ZvrZbanhV+O4ZmEC
3tPeoL3nP6DghzkLXjPgjQopACM7rbXYFuNOzVLNcud8gK7eR9zzS7fHcqZi4YO0zJK8
jG23SHqv0PMusUg2iGlltEwohBB6AruzkxItfJQ3XrQaEjTpMy/SgT+kWT6Nl9gGNklu
FAf/Fdu9DEANuT1Dg6GzHA7pD/O2yqZ+htkvz7tUHOS50oSbGAwuPKQsEQbJA//Gkk+h
JIsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc:content-transfer-encoding;
bh=UxGwlI/qgHXs4uW0kScMq9qRFg9ZKhK8Pr+5XEm5JXU=;
b=fsl5JEiXu9w9a5fTmfgvA/BlkXhthy2ywX5TwS9JGl/NT7Q8Bb0l8QgK0CHs0pikS/
bUG3huUrPrbtaBX/s0ovp8tdyyCZ0DnhggCPGijF/uxc0iGvlPTYoDK6eJ0Fk9qlokaX
M2A2YdMz54drSyF29ohq1BnaJ6f53sNeNIMQ0kK4AdbSQGAm9z+ZxSX2U4qHNfc0cKY4
ePAPu4zj5NY6K7Y9hOrzgaMtdqbDRFrpclV+uPEVM0OuaC0G6uBijbtkEi1oCxL2gnLF
xX7pZ9HPwZreMNGim68/TQ1ZSGsm0MGrOw2j3R4Vz+Mq+IKWEJkvKnLLspS6HRmROVox
wxyg==
X-Gm-Message-State: AOAM531oyOUIBzHBz6Cv6zNf0RDff8WQQvHqL2cji6C8Fmxu0cDyVxEx
JwZ5OKatYKd4nUxpHmd5UUU1RgmvQrEozQ9S4qg=
X-Google-Smtp-Source: ABdhPJxyqVrudCfmejkBi1FzWr30qILshjFZZh5NeLxmbowaJSQ1f+WX/rYtakz3gKZJIwvt3YaTQHForbNtD1U7T74=
X-Received: by 2002:a17:90a:ae15:: with SMTP id
t21mr23881523pjq.55.1621834467225;
Sun, 23 May 2021 22:34:27 -0700 (PDT)
In-Reply-To: <5cec7f52-a66b-608c-4816-a3d8816658b2@adminart.net>
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: <CA+FnnTyLPWPz9Jt4LXSL0hhQ3n2UWgicX49RdTADqtFj9jcP5w@mail.gmail.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>
<CACFDE8bsJe2BMNwsXAiGyxsMxNE+RuENj62GtfEzqodh5O_mMA@mail.gmail.com>
<5cec7f52-a66b-608c-4816-a3d8816658b2@adminart.net>
 by: Igor Korot - Mon, 24 May 2021 05:34 UTC

Hi,

On Mon, May 24, 2021 at 12:26 AM hw <hw@adminart.net> wrote:
>
> On 5/23/21 10:02 PM, Stestagg wrote:
> >
> >
> > On Sun, 23 May 2021 at 20:37, hw <hw@adminart.net
> > <mailto:hw@adminart.net>> 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.
> >
> >
> > Shadowing is effectively saying “within this bit of code, (scope) I’m
> > going to use an already-used name for my own value”
>
> That should give at least a warning.
>
> > 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.
> >
> >
> > There are some reasons why allowing this is quite nice. And there’s
> > actually a ton of corner cases to consider when thinking about changing
> > the rules
>
> Perl has a way to turn off unwanted warnings. It won't change the rules
> to give a warning.
>
> > Interestingly python 3 made this a little bit better by stopping you
> > from rebinding (shadowing) a number of built ins, such as True and False.
> >
> > In your case, I agree that it is super confusing.
>
> It seems dangerous and seems to show that python is too unfinished to be
> used. For all I know, it makes it easy to, for example, drop a whole
> table in a database because something was shadowed without warning.
>
> I can imagine that there can be all kinds of situations in which
> something like that happens, and you can spend hours or days trying to
> figure out what's wrong and may never find it.
>
> > One thing to learn to
> > look out for is if you assign to a name, then use that name on a
> > different context, expecting it to be different, then that’s not likely
> > to work as you expect.
>
> Then why doesn't give it at least a warning?
>
> There is even no indication from the output from the program before it
> aborts with an error message that something might be wrong: For
> 'type(float)', it prints "<class 'float'>" just like it does for int.
> How is anyone supposed to debug stuff like that?
>
> Why doesn't print(type(float)) give an error message after the variable
> type was already defeated (or prints something else)? What is it
> actually printing?
>
> > It seems like a recipie
> > for creating chaos.
> >
> >
> > Luckily almost every python code checker and/or linter will highlight
> > this for you.
> >
> > If you’re learning python, I’d highly recommend doing so in an ide or
> > editor that has a code checker running.
>
> Emcas highlights the syntax fine; I don't know if it can do more for
> python. It shouldn't need to.
>
> Things get creepy when a programming language makes it so that the
> programmer can't figure out anymore how a result produced by his program
> has come about.

Remember - python is an untyped language.
It is not C, C++ or even Pascal.

So there is no difference whether you write

float = 5.0

or

float1 = 5.0

Thank you.

> --
> https://mail.python.org/mailman/listinfo/python-list

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor