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

Brendan Moloney moloney at ohsu.edu
Fri Jul 8 01:45:01 CEST 2011


Why provide two functions instead of just something like innested and allow the user to switch the arguments?

Brendan Moloney
Senior Research Assistant / Programmer
Advanced Imaging Research Center
Oregon Health Science University
________________________________________
From: python-ideas-bounces+moloney=ohsu.edu at python.org [python-ideas-bounces+moloney=ohsu.edu at python.org] On Behalf Of John O'Connor [jxo6948 at rit.edu]
Sent: Thursday, July 07, 2011 4:24 PM
To: Giampaolo Rodolà
Cc: python-ideas at python.org
Subject: Re: [Python-ideas] os.path.isparent and os.path.ischild

On Thu, Jul 7, 2011 at 4:08 PM, Giampaolo Rodolà <g.rodola at gmail.com<mailto:g.rodola at gmail.com>> wrote:
>>> isparent('/a', '/a/b')
True
>>> isparent('/a/b', '/a')
False

>>> ischild('/a/b', '/a')
True
>>> ischild('/a', '/a/b')
False

What about is{ancestor, descendant}() ?

>>> isancestor('/a', '/a/b/c')
True
>>> isparent('/a', '/a/b/c')
False



More information about the Python-ideas mailing list