[Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous
Chris Angelico
rosuav at gmail.com
Thu Apr 24 08:43:50 CEST 2014
More information about the Python-Dev mailing list
Thu Apr 24 08:43:50 CEST 2014
- Previous message: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable
- Next message: [Python-Dev] Software integrators vs end users (was Re: Language Summit notes)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Apr 24, 2014 at 1:59 PM, Łukasz Langa <lukasz at langa.pl> wrote: > On Apr 17, 2014, at 11:49 AM, Brett Cannon <bcannon at gmail.com> wrote: > >> Think of tuples like a struct in C, lists like an array. > > > I generally agree but it’s a bit more complex, for instance when you have a > homogenous sequence but want it to be hashable. I just hit that today and > felt a little bad using tuple because of that “struct” mindset :) All you need is a "frozenlist" type, parallel to "frozenset": frozenlist = tuple # Magic! some_dict[frozenlist([...])] = some_value ChrisA
- Previous message: [Python-Dev] List vs Tuple / Homogeneous vs Heterogeneous / Mutable vs Immutable
- Next message: [Python-Dev] Software integrators vs end users (was Re: Language Summit notes)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list