Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #33966

Re: Python dictionaries are awesome

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; 'bug.': 0.07; 'problem?': 0.07; 'url:blog': 0.09; 'keyed': 0.09; 'tends': 0.09; 'cc:addr:python-list': 0.10; 'language': 0.14; 'attribute,': 0.16; 'dictionary.': 0.16; 'hypothetical': 0.16; 'subject:dictionaries': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'wrote:': 0.17; 'tries': 0.17; 'sort': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'checking': 0.27; 'continuing': 0.27; 'language.': 0.27; "d'aprano": 0.29; 'steven': 0.29; 'implement': 0.32; 'languages': 0.33; 'especially': 0.35; 'pm,': 0.35; 'but': 0.36; 'should': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'some': 0.38; 'delete': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'url:p': 0.63; 'making': 0.64; 'header:Reply- To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'flash': 0.72; 'account.': 0.83; 'profiles,': 0.84; 'taken.': 0.84; 'thing,': 0.84; 'what\xe2\x80\x99s': 0.84; 'careful': 0.91; 'you\xe2\x80\x99re': 0.91
Date Tue, 27 Nov 2012 00:27:53 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To Steven D'Aprano <steve+comp.lang.python@pearwood.info>
Subject Re: Python dictionaries are awesome
References <50b4262a$0$21875$c3e8da3$76491128@news.astraweb.com>
In-Reply-To <50b4262a$0$21875$c3e8da3$76491128@news.astraweb.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Provags-ID V02:K0:zdyk+ha0QqAxI63P/0JQKvK9ld8/HX3dyXA643kYKj4 hrZ2vbVz+Plio6hPEsQx6OO4NelCkiStaGyd9GZ68unlQhGksj CsOLkKO8fTVKY5IpMBbkyPI5kCN5qVkRghfc1vUAVuiyGxtu7U NZ6fqhMyHZnk/l9Bxb/23LSSMIPXRyZ8RKrn9KsSmQvbr3dP9+ Ls4iVwRwNbZXH3wyDGmvL3NiVV8gqoeVufbQ2M0+lwvjw85kbq DKxV0oJn3weTiVfiGlP4pT6hiPWjvW3K2S5qXOYDyz+68TnH+B 3Do1oO8BfbRX7VU+G3tsZMoGwUep4k21zitboSleIbvvNvgzA= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.310.1353994088.29569.python-list@python.org> (permalink)
Lines 32
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353994088 news.xs4all.nl 6931 [2001:888:2000:d::a6]:45286
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33966

Show key headers only | View raw


On 11/26/2012 09:32 PM, Steven D'Aprano wrote:
> ... especially when you consider how some other languages implement them.
>
>
> http://twistedoakgames.com/blog/?p=925
>
> [quote]
> Here’s the hypothetical situation: you’re making a flash game. In that 
> game users can create named profiles. You store the profiles, keyed by 
> their name, so that you ca- OOPS, you just introduced a bug. What’s the 
> problem? The dictionary.
> [end quote]
>
>

(facetious)
Whenever someone tries to create a username that happens to conflict
with a pre-existing attribute, just tell them that username is already
taken.  Just watch out when your user HasOwnProperty tries to delete his
account.
(/facetious)

Namespaces are great, we should have lots of them.  But be very careful
about reusing one without checking to see if it's already inhabited.

When a language design does this sort of thing, it tends to make us
skittish about continuing use of said language.

-- 

DaveA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python dictionaries are awesome Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-27 02:32 +0000
  Re: Python dictionaries are awesome Dave Angel <d@davea.name> - 2012-11-27 00:27 -0500
  Re: Python dictionaries are awesome Chris Angelico <rosuav@gmail.com> - 2012-11-27 17:16 +1100

csiph-web