Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39154
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!roy |
|---|---|
| From | Roy Smith <roy@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: Dictionaries with tuples or tuples of tuples |
| Date | Mon, 18 Feb 2013 20:17:03 -0500 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 21 |
| Message-ID | <roy-1D2064.20170318022013@news.panix.com> (permalink) |
| References | <c8abdc96-a47c-462a-9d6e-fcbaad1102fe@googlegroups.com> |
| NNTP-Posting-Host | localhost |
| X-Trace | reader1.panix.com 1361236623 29673 127.0.0.1 (19 Feb 2013 01:17:03 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Tue, 19 Feb 2013 01:17:03 +0000 (UTC) |
| User-Agent | MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
| Xref | csiph.com comp.lang.python:39154 |
Show key headers only | View raw
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