Best search algorithm to find condition within a range

Chris Angelico rosuav at gmail.com
Thu Apr 9 20:07:29 CEST 2015


On Fri, Apr 10, 2015 at 3:41 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> There are good ways to deal with out-of-range results in systems languages:
>
> - well-defined wrap-around behaviour;
> - saturation;
> - trapping.
>
> "Do whatever the hell the compiler feels like doing" is not one of them.

Systems languages are already going to be somewhat close to the metal.
They're an alternative to rewriting your code completely for every
platform you're on. If you have to guard a few small sections with
configure-time checks, that's still saved you the work of writing all
the rest of your code twice.

With applications languages, as earlier mentioned, none of this should
be necessary. Sacrifice the performance and have arbitrary-precision
integers, Unicode strings, garbage collection, and first-class
lists/functions/mappings etc. This is only about lower-level
languages.

ChrisA



More information about the Python-list mailing list