PyWart: Language missing maximum constant of numeric types!
python at mrabarnett.plus.com
Sat Feb 25 18:54:56 CET 2012
On 25/02/2012 08:18, Wolfgang Meiners wrote:
> Am 24.02.12 14:37, schrieb Rick Johnson:
>> I get sick and tired of doing this!!!
>> if maxlength == UNLIMITED:
>> elif len(string)> maxlength:
>> What Python needs is some constant that can be compared to ANY numeric
>> type and that constant will ALWAYS be larger!
> If there is no limit for len(string), why not simply use
> # get_limit() returns None if there is no limit
> maxlength = get_limit()
> if maxlength and (len(string)<= maxlength):
That should be:
if maxlength is not None and len(string) <= maxlength:
More information about the Python-list