Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vgjlqg$ki9n$1@solani.org>
Deutsch   English   Français   Italiano  
<vgjlqg$ki9n$1@solani.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From: Mild Shock <janburse@fastmail.fm>
Newsgroups: comp.lang.python
Subject: Re: Two aces up Python's sleeve
Date: Fri, 8 Nov 2024 01:25:52 +0100
Message-ID: <vgjlqg$ki9n$1@solani.org>
References: <seven-20241106014329@ram.dialup.fu-berlin.de>
 <vgg5dn$ij48$1@solani.org>
 <050c2ce9efd8442fb902ecc926afb1ee42fe6c34.camel@tilde.green>
 <vgihe5$9tsc$1@solani.org> <lp4sgdFg90oU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 8 Nov 2024 00:25:52 -0000 (UTC)
Injection-Info: solani.org;
	logging-data="674103"; mail-complaints-to="abuse@news.solani.org"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
 Firefox/91.0 SeaMonkey/2.53.19
Cancel-Lock: sha1:UQZT+LmAjpPPnaehEz8szqeUjL8=
X-User-ID: eJwFwQkBwDAIA0BLfAlMTgvUv4TdwansDIKBh7cdMmWKvl/xxDGu6OTndienqmlTW4aG028+vSKQrTXsyR9MTRU1
In-Reply-To: <lp4sgdFg90oU1@mid.individual.net>
Bytes: 2270
Lines: 37

Hi,

In Java its possible to work this way
with the Integer datatype, just call
Integer.valueOf().

I am not sure whether CPython does the
same. Because it shows me the same behaviour
for small integers that are more than

only in the range -128 to 128. You can try yourself:

Python 3.14.0a1 (tags/v3.14.0a1:8cdaca8, Oct 15 2024, 20:08:21)
 >>> x,y = 10**10, 10**9*10
 >>> id(x) == id(y)
True

Maybe the idea that objects have an address
that can be accessed via id() has been abandoned.
This is already seen in PyPy. So maybe we

are falsly assuming that id() gives na object address.

Greg Ewing schrieb:
> On 8/11/24 3:04 am, Mild Shock wrote:
>> This only works for small integers. I guess
>> this is because tagged pointers are used
>> nowadays ?
> 
> No, it's because integers in a certain small range are cached. Not sure 
> what the actual range is nowadays, it used to be something like -5 to 
> 256 I think.
> 
> BTW you have to be careful testing this, because the compiler sometimes 
> does constant folding, so you need to be sure it's actually computing 
> the numbers at run time.
>