Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: DFS Newsgroups: comp.os.linux.advocacy Subject: Re: The Folly of Python Date: Mon, 15 Apr 2024 21:16:46 -0400 Organization: A noiseless patient Spider Lines: 38 Message-ID: References: <17c636a2d6477a17$13590$197378$802601b3@news.usenetexpress.com> <661c3aa1$0$2574$426a74cc@news.free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Tue, 16 Apr 2024 03:16:46 +0200 (CEST) Injection-Info: dont-email.me; posting-host="2b078b6dcce7c273cb53ebe064aa36bb"; logging-data="624363"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX197Xjrp4Ci3a88IPv+ndmSw" User-Agent: Betterbird (Windows) Cancel-Lock: sha1:ecDPGcEGqeP67zXjKAo+ZBucfSI= In-Reply-To: Content-Language: en-US Bytes: 2390 On 4/15/2024 7:42 AM, Chris Ahlstrom wrote: > rbowman wrote this copyrighted missive and expects royalties: > >> On 14 Apr 2024 20:20:49 GMT, Stéphane CARPENTIER wrote: >> >>> What's that? You mean "Object Oriented"? If yes, are you really a >>> programmer (in fact, I know the answer, it's a rhetorical question)? If >>> no, do you know that python doesn't require Object Oriented programming >>> (it's another rhethorical question)? >> >> Yes and no... Everything in Python is an object but you don't necessarily >> need to construct your own classes. > > https://www.linkedin.com/pulse/understanding-pythons-mutable-immutable-objects-memory-gihozo > > Integers are immutable objects in Python. When you modify an integer, a > new object is created instead of modifying the existing one. > > x = 10 > > Wowza! $ for i in range(10): print("int %d, id = %d" % (i, id(i))) int 0, id = 140706145489672 int 1, id = 140706145489704 int 2, id = 140706145489736 int 3, id = 140706145489768 int 4, id = 140706145489800 int 5, id = 140706145489832 int 6, id = 140706145489864 int 7, id = 140706145489896 int 8, id = 140706145489928 int 9, id = 140706145489960 wowza^10! What do you notice about those id numbers?