From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D16AF1381F3 for ; Tue, 13 Nov 2012 20:44:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7ED2B21C042; Tue, 13 Nov 2012 20:41:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C314021C033 for ; Tue, 13 Nov 2012 20:41:03 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A09BB33DA65 for ; Tue, 13 Nov 2012 20:41:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A3C7EE544C for ; Tue, 13 Nov 2012 20:40:58 +0000 (UTC) From: "Paul Varner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paul Varner" Message-ID: <1352684108.88ac4e9030ab5827d1ab4d01ee6c0aff85184d28.fuzzyray@gentoo> Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/keyword.py X-VCS-Directories: pym/gentoolkit/ X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner X-VCS-Revision: 88ac4e9030ab5827d1ab4d01ee6c0aff85184d28 X-VCS-Branch: gentoolkit Date: Tue, 13 Nov 2012 20:40:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 792fffe0-8a5f-49fb-93a4-2b06fc32bc7b X-Archives-Hash: bea5c570d75db8aa266e561fc54510c7 commit: 88ac4e9030ab5827d1ab4d01ee6c0aff85184d28 Author: W. Trevor King tremily us> AuthorDate: Mon Nov 12 01:35:08 2012 +0000 Commit: Paul Varner gentoo org> CommitDate: Mon Nov 12 01:35:08 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=88ac4e90 keyword: use Python 2/3-agnostic set notation in reduce_keywords doctest Python 2.7 prints sets as "set([1, 2])", but Python 3.2 prints them as "{1, 2}". Avoid having to chose by showing that the result of reduce_keywords() is a set, and then printing the elements in a list. --- pym/gentoolkit/keyword.py | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/keyword.py b/pym/gentoolkit/keyword.py index 17b3472..a234116 100644 --- a/pym/gentoolkit/keyword.py +++ b/pym/gentoolkit/keyword.py @@ -95,8 +95,11 @@ def reduce_keywords(keywords): """Reduce a list of keywords to a unique set of stable keywords. Example usage: - >>> reduce_keywords(['~amd64', 'x86', '~x86']) - set(['amd64', 'x86']) + >>> kw = reduce_keywords(['~amd64', 'x86', '~x86']) + >>> isinstance(kw, set) + True + >>> sorted(kw) + ['amd64', 'x86'] @type keywords: array @rtype: set