From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on ip-172-31-91-241.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=none autolearn=ham autolearn_force=no version=4.0.1 Path: nntp.eternal-september.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Lawrence =?iso-8859-13?q?D=FFOliveiro?= Newsgroups: comp.lang.ada Subject: Re: In precision typing we trust Date: Sat, 30 Aug 2025 22:34:55 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: <108vuaf$2sngv$5@dont-email.me> References: <107uv9g$3019a$1@dont-email.me> <107v1ji$303of$1@dont-email.me> <336fbb5f-a279-ea8e-67fd-f62bb00d6a89@irrt.De> <107vfb9$34cpj$1@dont-email.me> <10855lq$gj8l$1@dont-email.me> <1088h1a$19635$1@dont-email.me> <1089p1i$1ig1d$1@dont-email.me> <108aq2p$1qo9o$1@dont-email.me> <108dh2l$2f5h3$1@dont-email.me> <108ej11$2mbr8$1@dont-email.me> <108g1fv$32gqg$3@dont-email.me> <108h6b7$3a75k$3@dont-email.me> <108ijfj$3lihe$4@dont-email.me> <108jqcg$3ti12$2@dont-email.me> <87cy8im3kc.fsf@nightsong.com> <108kp8k$5pr0$1@dont-email.me> <878qj5my4l.fsf@nightsong.com> <20250828142557.1ec4a637@tag.xn--rombobjrn-67a.se> <108qkci$1kvjl$1@dont-email.me> <20250829173021.53befdce@tag.xn--rombobjrn-67a.se> <108trgb$2ctc1$4@dont-email.me> <108udui$2gpva$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 30 Aug 2025 22:34:56 +0000 (UTC) Injection-Info: dont-email.me; posting-host="c0b3afac58395fcfe10cd8a8a01c5d34"; logging-data="3038751"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EI87tsvjCOJLn6uqbSfCu" User-Agent: Pan/0.163 (Kryvyi Rih) Cancel-Lock: sha1:BNZq3uQXWDZ1Xp90Wgpeacl9jUI= Xref: feeder.eternal-september.org comp.lang.ada:67004 List-Id: On Sat, 30 Aug 2025 08:49:22 -0000 (UTC), Kevin Chadwick wrote: >> Ada may be helpful with keeping complex things manageable. But Python >> helps keep simple things simple, in a way that Ada cannot. > > I don't know if there is *ANY* truth to that as I do not use Python > but your example seems to suggest Python has complicated gotchas > where Ada is simple. The code you linked didn't seem anywhere near > as readable as Ada either. You mean the BitVector example? That was a dump from a Jupyter notebook, in “asciidoc” format, with various indicators as to what was input source and what was program output. Here’s what the code looks like without that: # constructor: v = BitVector(«width»[, «init»]) # «init» defaults to all zeroes if omitted v1 = BitVector(3, 2) v2 = BitVector(5) v1, v2, int(v1), int(v2) # access can be single bits, or use standard Python slice notation v1[0:2], v1[2], v1[1:3], v2[2:5] v1[1:3] = [False, True] v2[:] = 13 v1, v2, int(v1), int(v2) # “+” does concatenation of BitVectors; note little-endian ordering. v1 + v2, int(v1 + v2) # shifts produce results with same number of bits v2, v2 >> 3, v2 << 3, v2[:3] << 3, (v2 + BitVector(3)) << 3 v1[1:3] Following all raise errors v2[:1] = v1 v1[:] = 8 v2[0] = 2 v1[:] = v2[:] I’ll leave you to go back and reread the other posting, to see how the output relates to that ...