[Python-ideas] os.path.isparent and os.path.ischild

Steven D'Aprano steve at pearwood.info
Thu Jul 14 03:27:00 CEST 2011


Paul Colomiets wrote:
> Hi,
> 
> On Fri, Jul 8, 2011 at 2:08 AM, Giampaolo Rodolà <g.rodola at gmail.com> wrote:
>>>>> isparent('/a', '/a/b')
>> True
>>>>> ischild('/a/b', '/a')
>> True
> 
> Do you mean:
> 
>>>> '/a' == dirname('/a/b')
> True
>>>> dirname('/a/b') == '/a'
> True
> 
> I do not think it's harder to write.
> 


How about this?

isparent('/a/b/c', '/a/b/c/d/e/f/g')
=> should return True


-- 
Steven









More information about the Python-ideas mailing list