Significance of "start" parameter to string method "endswith"

Boris Dušek boris.dusek at gmail.com
Thu Apr 19 16:57:16 EDT 2007


On Apr 19, 10:36 pm, subscriber123 <collinsto... at gmail.com> wrote:
> On Apr 19, 3:58 pm, Boris Dušek <boris.du... at gmail.com> wrote:
>
>
>
> > Hello,
>
> > what is the use-case of parameter "start" in string's "endswith"
> > method?

> def foo(function,instance,param):
>     if function(instance,param,2,4):
>         return True
>     else: return False
>
> The function must work whether you pass it
> foo(str.endswith,"blaahh","ahh"), or
> foo(str.startswith,"blaahh","aah"). This is a really bad example, but
> it gets the point across that similar functions must have similar
> parameters in order to be Pythonic.

Thanks for explanation, this point makes sense. And I agree that I can
hardly imagine any use of both parameters :-).




More information about the Python-list mailing list