Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82205
| Path | csiph.com!usenet.pasdenom.info!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail |
|---|---|
| From | "Dave Angel" <dave.angel@1:249/999.remove-cdt-this> |
| To | Denis McMahon |
| Subject | Re: Nested dictionaries from a list ? |
| Message-ID | <54866F2E.1743.complang@piz.noip.com> (permalink) |
| X-Comment-To | Denis McMahon |
| Newsgroups | comp.lang.python |
| X-FTN-AREA | COMP.LANG.PYTHON |
| X-FTN-PID | SoupGate-Win32 v1.05 |
| X-FTN-MSGID | <mailman.16722.1418045741.18130.python-list@python.org> a966554f |
| X-FTN-REPLY | <m62p8f$fn7$3@dont-email.me> 27954787 |
| Content-Type | text/plain; charset=IBM437 |
| Content-Transfer-Encoding | 8bit |
| X-Gateway | piz.noip.com [Synchronet 3.15b-Win32 NewsLink 1.92] |
| X-Server | piz.noip.me |
| Date | 9 Dec 2014 11:31:59 -0500 |
| Lines | 33 |
| Organization | Unlimited download news at news.astraweb.com |
| NNTP-Posting-Host | 2266ad8f.news.astraweb.com |
| X-Trace | DXC=LP`[=a9Aa>U]oQN>6;?:kYL?0kYOcDh@ZRScV177L_PQZh[e@ZS;QSSl23]GVn`ZmVMHo6fPSBkU[04hIVDTD?[[7g\XjYcGehYfPiGS6_2a\] |
| Xref | csiph.com comp.lang.python:82205 |
Show key headers only | View raw
To: Denis McMahon
On 12/07/2014 06:52 PM, Denis McMahon wrote:
> On Sun, 07 Dec 2014 12:01:26 -0500, Dave Angel wrote:
>
>> On 12/07/2014 11:18 AM, Wacky wrote:
>
>>> I've a list of users ....
>
>> I haven't run this through the Python, so please forgive any typos.
>
>> users = [ ....
>> mess = { ....
>
> users is redundant, as it's mess.keys()
>
> maintaining a separate list of users and having the users as the keys in
> mess suggests redundancy, and the potential for errors if the two data
> items get out of synch. Better imo to just have the data in one place.
>
Unless there's an order that wants to be retained. But I would change
the list into a list of user objects, rather than of strings. And I'd
know that eventually it would be a sparse list (as users come and go,
and you don't want to reuse the indices). So it would be another
dictionary mapping userid and User instance.
--
DaveA
--- SoupGate-Win32 v1.05
* Origin: <SpaceSST.BBS.Fidonet<>NNTP.gateway.@.piz.noip.me> (1:249/999)
--- Synchronet 3.15b-Win32 NewsLink 1.92
SpaceSST BBS Usenet <> Fidonet Gateway
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Nested dictionaries from a list ? "Dave Angel" <dave.angel@1:249/999.remove-cdt-this> - 2014-12-09 11:31 -0500
csiph-web