Which type should be used when testing static structure appartenance

Jon Ribbens jon+usenet at unequivocal.co.uk
Wed Nov 18 08:32:29 EST 2015


On 2015-11-18, Steven D'Aprano <steve at pearwood.info> wrote:
> On Wed, 18 Nov 2015 11:40 pm, Chris Angelico wrote:
>> so I would say the choices are: Set 
>> literal if available, else tuple. Forget the performance.
>
> It seems rather strange to argue that we should ignore performance when the
> whole reason for using sets in the first place is for performance.

Who says the whole reason for using sets is performance? Sets behave
differently to tuples or lists - the members are guaranteed to be
unique.



More information about the Python-list mailing list