On Sun, 18 Jan 2009 22:28:04 +0000, Steven D'Aprano wrote: > Built-ins rarely accept None as a sentinel, slice() being a conspicuous > exception. This is sometimes a nuisance when writing wrappers: > > def my_find(S, sub, start=None, end=None): > """Like string.find() only with pre-processing.""" pre_process() # > stub for something complicated if end is None and start is None: > return S.find(sub) > elif end if None: > return S.find(sub, start) > else: > return S.find(sub, start, end)
Typical. As of Python 2.6, string.find accepts None as sentinels. All my beautiful, beautiful code made obsolete!!! *wink* -- Steven -- http://mail.python.org/mailman/listinfo/python-list