PyWart: Language missing maximum constant of numeric types!

Chris Angelico rosuav at gmail.com
Sun Feb 26 07:52:16 EST 2012


On Sun, Feb 26, 2012 at 10:56 PM, Wolfgang Meiners
<WolfgangMeiners01 at web.de> wrote:
> That means:
> if maxlength and (len(string) <= maxlength):
>
> is equivalent to
> if (maxlength is not None) and (len(string) <= maxlength):

On the contrary, it means they are distinctly NOT equivalent. The
shorter form would treat a maximum length of 0 as meaning "unlimited".
Now, that's an understandable notation, but it's not what's given
here; if None means unlimited, then 0 should enforce that string ==
"".

ChrisA



More information about the Python-list mailing list