Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #37706
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <lars@rational-it.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'classes,': 0.05; 'sub': 0.09; 'subclasses': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; '(the': 0.15; 'classes:': 0.16; 'cls': 0.16; 'correctly,': 0.16; 'sense,': 0.16; 'latter': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '(which': 0.26; 'common': 0.26; 'class': 0.29; 'classes': 0.30; 'help,': 0.32; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'skip:u 20': 0.36; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'gives': 0.39; 'further': 0.61; 'first': 0.61; 'safe': 0.63; 'decided': 0.65; 'account': 0.67 |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:path:newsgroups:date:in-reply-to:complaints-to :injection-info:nntp-posting-host:references:user-agent :x-google-web-client:x-google-ip:mime-version:message-id:subject :from:to:cc:content-type:content-transfer-encoding :x-gm-message-state; bh=l7alvomzAA+w5WWelyUh7Mk+YH9K85zJHQZ9yh9rCu8=; b=bB2AW38A83TeLdlump94nw76eyNVPPO282pL1HSs+pSSUmjbxHl3KI95gvS0YHkzgS gOz7LXo7OAMUa6wjve1FigcbtHHsKkmol8+mDk5tdo5JiNsySfotDbY8gRWj7j4Vn4mC aowDZVTR0EBJt1AdnkzuOA1Rg87jda4RiEXXUGBeDst0AgOkazWJfFAn30FKFvxNfEkT I/jp5H/9whlG3/IuyWRMrHTPIZFK+51zoh/oe8BsMTDE7a4mFTupm8iGlgw1WJcaCGK9 xUqIV1BAxCDyszOJCA+MA4ZDNIj1Aq2WyD2aAFHY0pM6cn3+woONHEBHGy9AXQvjzi64 iF9g== |
| X-Received | by 10.49.116.139 with SMTP id jw11mr1678645qeb.12.1359161297817; Fri, 25 Jan 2013 16:48:17 -0800 (PST) |
| Newsgroups | comp.lang.python |
| Date | Fri, 25 Jan 2013 16:48:17 -0800 (PST) |
| In-Reply-To | <0d837f4c-c4a7-4df6-978c-b62a10ef9d70@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=94.209.206.24; posting-account=gpkyRAoAAABlPh1mY6Zt264UpMjIbxAz |
| References | <766ec7eb-ab43-4c17-8073-3a0e6a8b89ea@googlegroups.com> <mailman.1052.1359140888.2939.python-list@python.org> <0d837f4c-c4a7-4df6-978c-b62a10ef9d70@googlegroups.com> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 94.209.206.24 |
| MIME-Version | 1.0 |
| Subject | Re: finding abc's |
| From | lars van gemerden <lars@rational-it.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Gm-Message-State | ALoCoQlpPU69r0/qg61y6T0fWcvLr4NGJ+jEkiU5ZfI7zLvS9K2YY51i0cKPL5l9tA89lzGG8Gbc |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.1066.1359161309.2939.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1359161309 news.xs4all.nl 6985 [2001:888:2000:d::a6]:59444 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:37706 |
Show key headers only | View raw
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 common if not any(sub in common for sub in cls.__subclasses__())] #the classes of which no subclasses are present
def unique_common_base(classes):
while len(classes) > 1:
classes = common_bases(classes)
return classes.pop()
if i tested and understood correctly, they only take classes in the mro() into account (which might include abc's), the first gives all common base classes, the second recursively reduces further to one single class (the latter might not make to much sense, but in my program it is a safe bet for rare cases).
Thanks again for the help,
Cheers, Lars
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 09:40 -0800
Re: finding abc's Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-25 12:04 -0700
Re: finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 12:05 -0800
Re: finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 12:05 -0800
Re: finding abc's Peter Otten <__peter__@web.de> - 2013-01-25 20:08 +0100
Re: finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 12:08 -0800
Re: finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 16:48 -0800
Re: finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 16:48 -0800
Re: finding abc's lars van gemerden <lars@rational-it.com> - 2013-01-25 12:08 -0800
csiph-web