Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20933
| Date | 2012-02-27 12:55 +0100 |
|---|---|
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| Subject | Re: PyWart: Language missing maximum constant of numeric types! |
| References | <8c2096d9-3cc2-4b64-8f11-c1d958d94243@x19g2000yqh.googlegroups.com> <4f48996b$0$6639$9b4e6d93@newsspool2.arcor-online.net> <mailman.159.1330192496.3037.python-list@python.org> <0cee49d9-b5a6-4fd8-8cd2-e4373099d5ac@p7g2000yqk.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.192.1330343761.3037.python-list@python.org> (permalink) |
Rick Johnson wrote:
> On Feb 25, 11:54 am, MRAB <pyt...@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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-24 05:37 -0800
Re: PyWart: Language missing maximum constant of numeric types! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-24 13:55 +0000
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-24 06:14 -0800
Re: PyWart: Language missing maximum constant of numeric types! Neil Cerutti <neilc@norwich.edu> - 2012-02-24 14:25 +0000
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-24 07:25 -0800
Re: PyWart: Language missing maximum constant of numeric types! Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-24 12:32 -0500
Re: PyWart: Language missing maximum constant of numeric types! Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-24 18:26 -0700
Re: PyWart: Language missing maximum constant of numeric types! Miki Tebeka <miki.tebeka@gmail.com> - 2012-02-24 06:39 -0800
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-24 07:18 -0800
Re: PyWart: Language missing maximum constant of numeric types! Mel Wilson <mwilson@the-wire.com> - 2012-02-24 10:21 -0500
Re: PyWart: Language missing maximum constant of numeric types! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-24 15:31 +0000
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-24 07:34 -0800
Re: PyWart: Language missing maximum constant of numeric types! Michael Torrie <torriem@gmail.com> - 2012-02-24 09:23 -0700
Re: PyWart: Language missing maximum constant of numeric types! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-24 22:45 +0000
Re: PyWart: Language missing maximum constant of numeric types! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-24 16:59 +0000
Re: PyWart: Language missing maximum constant of numeric types! Michael Torrie <torriem@gmail.com> - 2012-02-24 16:16 -0700
Re: PyWart: Language missing maximum constant of numeric types! Chris Angelico <rosuav@gmail.com> - 2012-02-25 11:09 +1100
Re: PyWart: Language missing maximum constant of numeric types! Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-25 00:35 +0000
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-25 12:25 -0800
Re: PyWart: Language missing maximum constant of numeric types! MRAB <python@mrabarnett.plus.com> - 2012-02-25 00:37 +0000
Re: PyWart: Language missing maximum constant of numeric types! Serhiy Storchaka <storchaka@gmail.com> - 2012-02-25 17:32 +0200
Re: PyWart: Language missing maximum constant of numeric types! Fayaz Yusuf Khan <fayaz.yusuf.khan@gmail.com> - 2012-02-25 06:52 +0530
Re: PyWart: Language missing maximum constant of numeric types! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-25 01:50 +0000
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-25 12:29 -0800
Re: PyWart: Language missing maximum constant of numeric types! alex23 <wuwei23@gmail.com> - 2012-02-26 18:32 -0800
Re: PyWart: Language missing maximum constant of numeric types! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-27 03:51 +0000
Re: PyWart: Language missing maximum constant of numeric types! Chris Angelico <rosuav@gmail.com> - 2012-02-27 14:59 +1100
Re: PyWart: Language missing maximum constant of numeric types! alex23 <wuwei23@gmail.com> - 2012-02-26 22:49 -0800
Re: PyWart: Language missing maximum constant of numeric types! Wolfgang Meiners <WolfgangMeiners01@web.de> - 2012-02-25 09:18 +0100
Re: PyWart: Language missing maximum constant of numeric types! MRAB <python@mrabarnett.plus.com> - 2012-02-25 17:54 +0000
Re: PyWart: Language missing maximum constant of numeric types! Rick Johnson <rantingrickjohnson@gmail.com> - 2012-02-25 12:35 -0800
Re: PyWart: Language missing maximum constant of numeric types! Wolfgang Meiners <WolfgangMeiners01@web.de> - 2012-02-26 14:16 +0100
Re: PyWart: Language missing maximum constant of numeric types! Wolfgang Meiners <WolfgangMeiners01@web.de> - 2012-02-26 14:38 +0100
Re: PyWart: Language missing maximum constant of numeric types! Arnaud Delobelle <arnodel@gmail.com> - 2012-02-26 13:44 +0000
Re: PyWart: Language missing maximum constant of numeric types! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-26 13:50 +0000
Re: PyWart: Language missing maximum constant of numeric types! Neil Cerutti <neilc@norwich.edu> - 2012-02-27 12:25 +0000
Re: PyWart: Language missing maximum constant of numeric types! Jean-Michel Pichavant <jeanmichel@sequans.com> - 2012-02-27 12:55 +0100
Re: PyWart: Language missing maximum constant of numeric types! Wolfgang Meiners <WolfgangMeiners01@web.de> - 2012-02-26 12:56 +0100
Re: PyWart: Language missing maximum constant of numeric types! Chris Angelico <rosuav@gmail.com> - 2012-02-26 23:52 +1100
Re: PyWart: Language missing maximum constant of numeric types! Wolfgang Meiners <WolfgangMeiners01@web.de> - 2012-02-26 14:32 +0100
Re: PyWart: Language missing maximum constant of numeric types! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-26 13:19 +0000
csiph-web