[Python-ideas] os.path.isparent and os.path.ischild
Brendan Moloney
moloney at ohsu.edu
Fri Jul 8 02:54:18 CEST 2011
There are a small number of operators which can be used on a large number of types. There is also a long standing tradition of having distinct symbols for reciprocal operations in mathematics.
Should we provide reciprocal functions whenever possible? Should there be a 'issuperclass' function to compliment the 'issubclass' function?
At some point you have to ask if the increased clutter in the API is worth the improved readability. In this case I am not sure that it does.
Brendan
________________________________________
From: chris at rebertia.com [chris at rebertia.com] On Behalf Of Chris Rebert [pyideas at rebertia.com]
Sent: Thursday, July 07, 2011 5:30 PM
To: Brendan Moloney
Cc: John O'Connor; Giampaolo Rodolà; python-ideas at python.org
Subject: Re: [Python-ideas] os.path.isparent and os.path.ischild
> From: John O'Connor [jxo6948 at rit.edu]
<snip>
> What about is{ancestor, descendant}() ?
>
>>>> isancestor('/a', '/a/b/c')
> True
>>>> isparent('/a', '/a/b/c')
> False
On Thu, Jul 7, 2011 at 4:45 PM, Brendan Moloney <moloney at ohsu.edu> wrote:
> Why provide two functions instead of just something like innested and allow the user to switch the arguments?
<satire>
Why provide pairs of comparison operators [(>, <), (>=, <=)] instead
of just one from each pair? The user can always switch the arguments
themself.
</satire>
Cheers,
Chris
More information about the Python-ideas
mailing list