PyWart: Language missing maximum constant of numeric types!
Jean-Michel Pichavant
jeanmichel at sequans.com
Mon Feb 27 06:55:52 EST 2012
More information about the Python-list mailing list
Mon Feb 27 06:55:52 EST 2012
- Previous message (by thread): PyWart: Language missing maximum constant of numeric types!
- Next message (by thread): PyWart: Language missing maximum constant of numeric types!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Rick Johnson wrote: > On Feb 25, 11:54 am, MRAB <pyt... at mrabarnett.plus.com> wrote: > >> [...] >> That should be: >> if maxlength is not None and len(string) <= maxlength: >> > > Using "imaginary" infinity values defiles the intuitive nature of your > code. What is more intuitive? > > def confine_length(string, maxlength=INFINITY): > if string.length < maxlength: > do_something() > > def confine_length(string, maxlength=None): > if maxlength is not None and len(string) <= maxlength: > do_something() > This one: def confine_length(string, maxlength=None): """Confine the length. @param maxlength: the maximum length allowed, set it to None to allow any length. """ if maxlength is not None and len(string) <= maxlength: do_something() I'm just feeding the troll, I know ... :-/ JM
- Previous message (by thread): PyWart: Language missing maximum constant of numeric types!
- Next message (by thread): PyWart: Language missing maximum constant of numeric types!
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list