for future reference, i decided to go with 2 functions:
def common_bases(classes):
if not len(classes):
return None
common = set(classes.pop().mro())
for cls in classes:
common.intersection_update(cls.mro()) #all subclasses in common
return [cls for cls in co
On Friday, January 25, 2013 8:08:18 PM UTC+1, Peter Otten wrote:
> lars van gemerden wrote:
>
>
>
> > Hi all,
>
> >
>
> > i was writing a function to determine the common base class of a number
>
> > classes:
>
> >
>
> > def common_base(classes):
>
> > if not len(classes):
>
> >
On Friday, January 25, 2013 8:04:32 PM UTC+1, Ian wrote:
> On Fri, Jan 25, 2013 at 10:40 AM, lars van gemerden
>
> wrote:
>
> > Hi all,
>
> >
>
> > i was writing a function to determine the common base class of a number
> > classes:
>
> >
>
> [...]
>
> >
>
> > and ran common_base(int, flo
lars van gemerden wrote:
> Hi all,
>
> i was writing a function to determine the common base class of a number
> classes:
>
> def common_base(classes):
> if not len(classes):
> return None
> common = set(classes.pop().mro())
> for cls in classes:
> common.intersection
On Fri, Jan 25, 2013 at 10:40 AM, lars van gemerden
wrote:
> Hi all,
>
> i was writing a function to determine the common base class of a number
> classes:
>
[...]
>
> and ran common_base(int, float), hoping to get numbers.Number.
>
> this did not work because abstract base classes are not always