Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Problem with ifs

Received: by 10.14.220.131 with SMTP id o3mr10708774eep.6.1345664700752;
        Wed, 22 Aug 2012 12:45:00 -0700 (PDT)
X-BeenThere: pocoo-libs@googlegroups.com
Received: by 10.14.172.194 with SMTP id t42ls580441eel.0.gmail; Wed, 22 Aug
 2012 12:45:00 -0700 (PDT)
Received: by 10.14.220.131 with SMTP id o3mr10708755eep.6.1345664700106;
        Wed, 22 Aug 2012 12:45:00 -0700 (PDT)
Received: by 10.14.220.131 with SMTP id o3mr10708754eep.6.1345664700096;
        Wed, 22 Aug 2012 12:45:00 -0700 (PDT)
Return-Path: <simon.sa...@exyr.org>
Received: from hako.exyr.org ([2a01:e0b:1:125:ca0a:a9ff:fe03:3893])
        by gmr-mx.google.com with ESMTPS id d5si7024190eep.0.2012.08.22.12.44.57
        (version=TLSv1/SSLv3 cipher=OTHER);
        Wed, 22 Aug 2012 12:44:57 -0700 (PDT)
Received-SPF: temperror (google.com: error in processing during lookup of simon.sa...@exyr.org: DNS timeout) client-ip=2a01:e0b:1:125:ca0a:a9ff:fe03:3893;
Authentication-Results: gmr-mx.google.com; spf=temperror (google.com: error in processing during lookup of simon.sa...@exyr.org: DNS timeout) smtp.mail=simon.sa...@exyr.org
Received: from ip-222.net-80-236-80.issy.rev.numericable.fr ([80.236.80.222] helo=[192.168.0.11])
	by hako.exyr.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.72)
	(envelope-from <simon.sa...@exyr.org>)
	id 1T4GrE-00074v-JZ; Wed, 22 Aug 2012 21:44:52 +0200
Message-ID: <503536B5.7070901@exyr.org>
Date: Wed, 22 Aug 2012 21:44:53 +0200
From: Simon Sapin <simon.sa...@exyr.org>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0
MIME-Version: 1.0
To: Sam Pepler <pepler...@gmail.com>
CC: pocoo-libs@googlegroups.com
Subject: Re: Problem with ifs
References: <4aac5f93-6821-475c-9cc2-8e98d60db6bc@googlegroups.com> <5034EEA3.9040303@exyr.org> <a245a75f-ee7b-4952-9e20-2da461d9a843@googlegroups.com>
In-Reply-To: <a245a75f-ee7b-4952-9e20-2da461d9a843@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Le 22/08/2012 17:58, Sam Pepler a écrit :
> Thanks. That has indirectly sorted it out. I added a __eq__ method and
> that rasied an error suggesting one of the objects was a str. This is
> because the for loop is over a dictionary and that seems to produce a
> list of keys by default. I am now using the dictsort filter to unpack
> the values.

In Python, iterating over a dict gives only the keys. You might be 
interested in the .values() and .items() methods:

http://docs.python.org/library/stdtypes.html#dict

Cheers,
-- 
Simon Sapin