Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"We live, in a very kooky time." -- Herb Blashtfalt


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

SubjectAuthor
* Re: learning python ...Dennis Lee Bieber
`- Re: learning python ...Greg Ewing

1
Re: learning python ...

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: wlfr...@ix.netcom.com (Dennis Lee Bieber)
Newsgroups: comp.lang.python
Subject: Re: learning python ...
Date: Tue, 25 May 2021 11:33:01 -0400
Organization: IISS Elusive Unicorn
Lines: 86
Message-ID: <mailman.339.1621957043.3087.python-list@python.org>
References: <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>
<CAPTjJmpOXQ0m4-=uty96t+K9VCvZ_7UWdzPOKYw-vocRFq50eQ@mail.gmail.com>
<6ad46670-a0b4-d556-3b03-284ffa451c89@adminart.net>
<CAPTjJmr1z8Nyd2kbfrrc3X3wjCk80dt58-bSR=onCnALhbHjFA@mail.gmail.com>
<2aa42ad6-8a22-b7d4-5fc7-a589b361cad5@adminart.net>
<at4qagt8fq1sa8d3u1c7s5mdiittjl1b3s@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 8FgTiWZn6pYJZzFSbxHxaQF1o/4JXxO59MeGs3E/X5AQ==
Return-Path: <python-python-list@m.gmane-mx.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.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'def': 0.04; 'string':
0.05; 'subject:python': 0.06; 'space,': 0.07; 'compute': 0.09;
'received:ciao.gmane.io': 0.09; 'received:gmane.io': 0.09;
'received:list': 0.09; "can't": 0.14; '+0200,': 0.16; '1237':
0.16; 'case?': 0.16; 'confusion.': 0.16; 'integer': 0.16;
'integer,': 0.16; 'message-id:@4ax.com': 0.16; 'objects.': 0.16;
'received:116.202': 0.16; 'received:116.202.254': 0.16;
'received:116.202.254.214': 0.16; 'reuse': 0.16; 'memory': 0.16;
'python': 0.16; 'figure': 0.18; 'tue,': 0.18; 'uses': 0.19;
'addresses': 0.20; 'object': 0.23; 'to:addr:python-list': 0.23;
'actual': 0.24; 'code': 0.24; 'anything': 0.24; '>>>': 0.26;
'else': 0.27; 'header:User-Agent:1': 0.31;
'header:Organization:1': 0.31; 'but': 0.31; 'language.': 0.32;
'objects': 0.32; 'retrieve': 0.32; 'class': 0.33; 'skip:2 10':
0.36; 'table': 0.37; 'change': 0.37; 'those': 0.38; 'common':
0.60; 'everything': 0.64; 'pass': 0.64; 'free': 0.68; 'within':
0.68; 'refers': 0.69; 'above,': 0.71; 'received:116': 0.71;
'name,': 0.75; '....': 0.81; '2021': 0.84; 'garbage': 0.84;
'itself.': 0.84; 'type.': 0.84; 'url-ip:76/8': 0.84; 'keywords':
0.95
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: ForteAgent/8.00.32.1272
X-No-Archive: YES
X-Mailman-Approved-At: Tue, 25 May 2021 11:37:22 -0400
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: <at4qagt8fq1sa8d3u1c7s5mdiittjl1b3s@4ax.com>
X-Mailman-Original-References: <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>
<CAPTjJmpOXQ0m4-=uty96t+K9VCvZ_7UWdzPOKYw-vocRFq50eQ@mail.gmail.com>
<6ad46670-a0b4-d556-3b03-284ffa451c89@adminart.net>
<CAPTjJmr1z8Nyd2kbfrrc3X3wjCk80dt58-bSR=onCnALhbHjFA@mail.gmail.com>
<2aa42ad6-8a22-b7d4-5fc7-a589b361cad5@adminart.net>
 by: Dennis Lee Bieber - Tue, 25 May 2021 15:33 UTC

On Tue, 25 May 2021 04:59:19 +0200, hw <hw@adminart.net> declaimed the
following:

>Then what is 'float' in the case of isinstance() as the second
>parameter, and why can't python figure out what 'float' refers to in
>this case? Perhaps type names should be keywords to avoid confusion.

But consider...

>>> class something(object):
.... pass
....
>>> type(something)
<class 'type'>
>>>
>>> type(float)
<class 'type'>
>>> def anotherthing():
.... pass
....
>>> type(anotherthing)
<class 'function'>
>>>
>>> inst = something()
>>> type(inst)
<class '__main__.something'>
>>>

"something" IS a type name, just like "float" -- just one created at
run-time, not predefined by the language. How do you make it a keyword?
Everything you compute with in Python is an object -- they just have
different (meta)classes. The only things in Python that don't have a type
are the names being bound to the objects.

This is why Python is considered strongly typed: the OBJECTS have a
type and can not change type.

I = 42
I = I + 3
I = "42"

translates into:

Create an (anonymous) integer object somewhere in memory with the value
"42"
Bind the name "I" to that object
Retrieve the current value of the object bound to the name "I", create
a new object with the value retrieved + 3
(Re)Bind the name "I" to this new object (if nothing is bound to the 42
integer, it can be garbage collected)
Create an (anonymous) string object somewhere in memory with the value
'"42"'
(Re)Bind the name "I" to that object (if nothing else is bound to the
computed integer, it is free to be garbage collected)

>>> i = 42
>>> id(i)
140734613945200
>>> i = i + 3
>>> id(i)
140734613945296
>>> i = "42"
>>> id(i)
2150142776816
>>> i = 1237
>>> id(i)
2150142731632
>>>

The common (C)Python 1) uses the actual memory address of an object as
the "id"; 2) it caches small integers for reuse (probably a hard-coded
table <G> given those addresses which may be in the code space, vs heap
space); 3) you can't do anything with those "addresses" from within Python
itself.

As you can see above, each assignment to "i" is an object at a
different memory location

--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/

Re: learning python ...

<ih5d64FoesuU1@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: learning python ...
Date: Wed, 26 May 2021 10:48:34 +1200
Lines: 21
Message-ID: <ih5d64FoesuU1@mid.individual.net>
References: <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>
<CAPTjJmpOXQ0m4-=uty96t+K9VCvZ_7UWdzPOKYw-vocRFq50eQ@mail.gmail.com>
<6ad46670-a0b4-d556-3b03-284ffa451c89@adminart.net>
<CAPTjJmr1z8Nyd2kbfrrc3X3wjCk80dt58-bSR=onCnALhbHjFA@mail.gmail.com>
<2aa42ad6-8a22-b7d4-5fc7-a589b361cad5@adminart.net>
<at4qagt8fq1sa8d3u1c7s5mdiittjl1b3s@4ax.com>
<mailman.339.1621957043.3087.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net +ZIYR9Ga3YmMDdCXcgPQsgjOORHoguyk0aMXqUluPzh9/T3fJ6
Cancel-Lock: sha1:pl1cTgT5HwnRWizxwj4JJugl5dM=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <mailman.339.1621957043.3087.python-list@python.org>
Content-Language: en-US
 by: Greg Ewing - Tue, 25 May 2021 22:48 UTC

On 26/05/21 3:33 am, Dennis Lee Bieber wrote:
> the OBJECTS have a type and can not change type.

Well... built-in types can't, but...

>>> class A:
.... pass
....
>>> class B:
.... pass
....
>>> a = A()
>>> type(a)
<class '__main__.A'>
>>> a.__class__ = B
>>> type(a)
<class '__main__.B'>

--
Greg

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor