Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98925

Which type should be used when testing static structure appartenance

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 Évrard <nicoe@altern.org>
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 <mailman.388.1447770859.16136.python-list@python.org> (permalink)
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 <nicoe@altern.org>
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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98925

Show key headers only | View raw


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/

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Which type should be used when testing static structure appartenance Nicolas Évrard <nicoe@altern.org> - 2015-11-17 11:27 -0300
  Re: Which type should be used when testing static structure appartenance Steven D'Aprano <steve@pearwood.info> - 2015-11-18 22:37 +1100
    Re: Which type should be used when testing static structure appartenance Chris Angelico <rosuav@gmail.com> - 2015-11-18 23:40 +1100
      Re: Which type should be used when testing static structure appartenance Steven D'Aprano <steve@pearwood.info> - 2015-11-19 00:30 +1100
        Re: Which type should be used when testing static structure appartenance Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-11-18 13:32 +0000
        Re: Which type should be used when testing static structure appartenance Chris Angelico <rosuav@gmail.com> - 2015-11-19 00:42 +1100

csiph-web