startswith( prefix[, start[, end]]) Query

TheFlyingDutchman zzbbaadd at aol.com
Fri Sep 7 02:09:58 EDT 2007


> Else, you could as well write your own testing function:
>
> def str_starts_with(astring, *prefixes):
>    startswith = astring.startswith
>    for prefix in prefixes:
>      if startswith(prefix):
>        return true
>    return false
>

What is the reason for
  startswith = astring.startswith
  startswith(prefix)

instead of
  astring.startswith(prefix)




More information about the Python-list mailing list