Path: csiph.com!xmission!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Nicolas =?utf-8?Q?=C3=89vrard?= Newsgroups: comp.lang.python Subject: Which type should be used when testing static structure appartenance Date: Tue, 17 Nov 2015 11:27:39 -0300 Lines: 26 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 3yGZRwxPUrvcMVqc/l7OYASs2kt36rXNAPm45scwcDQQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.061 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'operator': 0.03; 'hettinger': 0.07; 'tuple.': 0.09; '+32': 0.16; 'hashes': 0.16; 'nicolas': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:type': 0.16; 'subject:when': 0.16; 'url:status': 0.18; 'proposed': 0.20; 'arrays': 0.22; 'programming': 0.22; 'wrote': 0.23; 'this:': 0.23; 'header:User-Agent:1': 0.26; 'tend': 0.27; 'sets.': 0.29; 'code': 0.30; 'raymond': 0.30; 'realize': 0.32; 'list': 0.34; 'something': 0.35; 'but': 0.36; 'should': 0.36; 'instead': 0.36; 'structures': 0.36; 'to:addr:python-list': 0.36; 'received:localhost.localdomain': 0.38; 'received:localdomain': 0.38; 'data': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'hello,': 0.40; 'your': 0.60; 'tel:': 0.65; 'website:': 0.65; 'received:190': 0.70; 'received:94.23': 0.72; 'saw': 0.77; 'message-id:@localhost.localdomain': 0.79; 'morning:': 0.84; 'utmost': 0.84; 'choice.': 0.93; 'colleague': 0.93 Mail-Followup-To: python-list@python.org Content-Disposition: inline X-OS: GNU/Linux User-Agent: Mutt/1.5.23.1 (2014-03-12) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98925 Hello, I saw the following retweet by Raymond Hettinger in this morning: https://twitter.com/sanityinc/status/666485814214287360 Programming tip: many of those arrays and hashes in your code should actually be sets. Match data structures to data constraints! I saw just in time because in a review I wrote something like this: if operator not in ('where', 'not where') and my colleague proposed that I should use a list instead of a tuple. But reading the mentioned tweet I tend to think that a set would be a better choice. What are your opinion on this issue (I realize it's not something of the utmost importance but rather a "philosophical" question). -- Nicolas Évrard - B2CK SPRL E-mail/Jabber: nicolas.evrard@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/