"Talin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Unfortunately, if the paragraph only contains a single word, > this blows up. So what you end up having to do is: > > parts = paragraph.split( ' ', 1 ) > if len( parts ) > 1: > first, rest = parts > else: > first = parts[ 0 ] > rest = "" > > My objection here is that the intent of the code is cluttered > up by the error-handling logic.
So wrap it all up in a function, especially if you need the logic more than once. > If I could do an argument-style unpack, however, I could instead > write: > > first, *rest = paragraph.split( ' ', 1 ) first, rest = my_para_split(s,1) tjr _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com