[Fredrik Lundh] > it is, however, a bit worrying that you end up ignoring one or more > of the values in about 50% of your examples... It drops to about 25% when you skip the ones that don't care about the found/not-found field:
> > ! _, sep, port = host.partition(':') > > ! head, sep, _ = path.rpartition('/') > > ! line, _, _ = line.partition(';') # strip > > ! pname, found, _ = pname.rpartition('.') > > ! line, _, _ = line.partition('#') > > ! filename, _, _ = filename.partition(chr(0)) The remaining cases don't bug me much. They clearly say, ignore the left piece or ignore the right piece. We could, of course, make these clearer and more efficient by introducing more methods: s.before(sep) --> (left, sep) s.after(sep) --> (right, sep) s.rbefore(sep) --> (left, sep) s.r_after(sep) --> (right, sep) But who wants all of that? Raymond _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com