On 22 Mar 2006 06:41:32 -0800, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
[snip]
[snip]
Shouldn't
> u"hello, world !".from("#")
u"hello, world !"
return None, otherwise what would the difference be between it and
>u"hello, world !".from("h")
u"hello, world !"
If it returns the whole string how would you test that a returned value was a not-found rather than a true result?
> if u"h" in u"hello, world !" and u"hello, world !".from("h"):
> return " u"hello, world !"
>else: # not really required, used for demonstration only
> return
:)
I often need to re-code for myself a small code snippet to define
string.upto() and string.from(), which are used like :
[snip]
# if not found, return whole string
> "hello, world !".upto("#")
"hello, world !"
> u"hello, world !".from("#")
u"hello, world !"
[snip]
Shouldn't
> u"hello, world !".from("#")
u"hello, world !"
return None, otherwise what would the difference be between it and
>u"hello, world !".from("h")
u"hello, world !"
If it returns the whole string how would you test that a returned value was a not-found rather than a true result?
> if u"h" in u"hello, world !" and u"hello, world !".from("h"):
> return " u"hello, world !"
>else: # not really required, used for demonstration only
> return
:)
-- http://mail.python.org/mailman/listinfo/python-list