From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Qm00C-0001Qb-Pb for garchives@archives.gentoo.org; Wed, 27 Jul 2011 09:02:05 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6474321C0E2 for ; Wed, 27 Jul 2011 09:02:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 70A9921C078 for ; Wed, 27 Jul 2011 08:26:44 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E8B251B4031 for ; Wed, 27 Jul 2011 08:26:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 53CE28003D for ; Wed, 27 Jul 2011 08:26:43 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/ X-VCS-Repository: proj/gentoopm X-VCS-Files: gentoopm/util.py X-VCS-Directories: gentoopm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: f6fc5c0432450ae6d30c347b3da4d34d2f88c9f0 Date: Wed, 27 Jul 2011 08:26:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 449534f8413a360d646ee04c6a8d7118 commit: f6fc5c0432450ae6d30c347b3da4d34d2f88c9f0 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Wed Jul 27 07:44:19 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Wed Jul 27 07:44:19 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoopm.git;= a=3Dcommit;h=3Df6fc5c04 SpaceSepTuple: support getting items by text. --- gentoopm/util.py | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/gentoopm/util.py b/gentoopm/util.py index f80d4a5..961c7d9 100644 --- a/gentoopm/util.py +++ b/gentoopm/util.py @@ -120,6 +120,11 @@ class SpaceSepTuple(tuple): s =3D s.split() return tuple.__new__(self, s) =20 + def __getitem__(self, k): + if isinstance(k, str): + return self[self.index(k)] + return tuple.__getitem__(self, k) + def __str__(self): return ' '.join(self) =20