Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39154
| From | Roy Smith <roy@panix.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Dictionaries with tuples or tuples of tuples |
| Date | 2013-02-18 20:17 -0500 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <roy-1D2064.20170318022013@news.panix.com> (permalink) |
| References | <c8abdc96-a47c-462a-9d6e-fcbaad1102fe@googlegroups.com> |
In article <c8abdc96-a47c-462a-9d6e-fcbaad1102fe@googlegroups.com>,
Jon Reyes <everystepsayes@gmail.com> wrote:
> So I have a dictionary and the key is a number.
> [...]
> col = {"1": (0,1,2,3): "2": ((0,1,2,3),(2,3,4,5))}
The keys here are strings, not numbers. But that's a detail. Somewhat
more importantly, that's a syntax error (one of the colons should be a
comma).
> The values are either a
> single tuple or a tuple of tuples. Is there a better way to go about
> accessing the values of the dictionary? All the tuples contain four elements.
I would make all the values the same shape, i.e. all lists of tuples:
col = {"1": [(0,1,2,3)]: "2": [(0,1,2,3),(2,3,4,5)]}
Then you're always doing the same thing with values when you process
them.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 16:52 -0800
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 20:11 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:19 -0800
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:19 -0800
Re: Dictionaries with tuples or tuples of tuples Roy Smith <roy@panix.com> - 2013-02-18 20:17 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:20 -0800
Re: Dictionaries with tuples or tuples of tuples Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 01:37 +0000
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:38 -0800
Re: Dictionaries with tuples or tuples of tuples Dave Angel <davea@davea.name> - 2013-02-18 20:51 -0500
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 20:56 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:17 -0800
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 21:54 -0500
Re: Dictionaries with tuples or tuples of tuples Dave Angel <davea@davea.name> - 2013-02-18 22:14 -0500
Re: Dictionaries with tuples or tuples of tuples Mitya Sirenef <msirenef@lightbird.net> - 2013-02-18 22:56 -0500
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:17 -0800
Re: Dictionaries with tuples or tuples of tuples Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-19 02:34 +0000
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:39 -0800
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 18:39 -0800
Re: Dictionaries with tuples or tuples of tuples Jon Reyes <everystepsayes@gmail.com> - 2013-02-18 17:38 -0800
csiph-web