On Sat, Aug 8, 2020, 1:12 AM Steven D'Aprano > Static languages often check what > bounds they can at compile time, and optionally insert bound checking > runtime code for ambiguous places.
Yep. That's an assert, or it's moral equivalent. Here's a deterministic program using the hypothetical new feature. def plusone(i: int[1:1_000_000_000]): return i+1 random.seed(42) for n in range(1_000_000): random.randint(1, 1_000_000_001) Is this program type safe? Tell me by static analysis of Mersenne Twister. Or if you want to special case the arguments to randint, will, lots of things. Let's say a "random" walk on the integer number line where each time through the loop increments or decrements some (deterministic but hard to calculate) amount. After N steps are we within certain bounds?
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/BUV7DSKL5NA3XX3V4WSD4BII5OI5ZZWC/ Code of Conduct: http://python.org/psf/codeofconduct/