PyWart: Language missing maximum constant of numeric types!

Neil Cerutti neilc at norwich.edu
Fri Feb 24 15:25:56 CET 2012


On 2012-02-24, Rick Johnson <rantingrickjohnson at gmail.com> wrote:
> I get sick and tired of doing this!!!
>
> if maxlength == UNLIMITED:
>     allow_passage()
> elif len(string) > maxlength:
>     deny_passage()
>
> What Python needs is some constant that can be compared to ANY
> numeric type and that constant will ALWAYS be larger!

What's the point of that?

The only time I've naively pined for such a thing is when
misapplying C idioms for finding a minimum value.

Python provides an excellent min implementation to use instead.

-- 
Neil Cerutti



More information about the Python-list mailing list