Am 24.02.12 14:37, schrieb Rick Johnson:
> 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!
> 
> 
> 
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):
    allow_passage()
else:
    deny_passage()

Wolfgang
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to