nested exceptions?

Terry Reedy tejarex at yahoo.com
Sun Apr 21 04:01:03 EDT 2002


"Roy Smith" <roy at panix.com> wrote in message
news:roy-AAA3A1.19193820042002 at news1.panix.com...
>     def getParentOid (self, oid):
>         parts = oid.split ('.')
>         parentParts = parts[:-1]
>         return '.'.join (parentParts)

You can do this part faster by using '.'.rfind(oid) to find *last* '.'
and then slice out part you want.

Terry J. Reedy





More information about the Python-list mailing list