Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29920
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jeanpierreda@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'python': 0.09; 'immutable': 0.09; 'lawrence': 0.09; 'porting': 0.09; 'received:mail-qc0-f174.google.com': 0.09; 'sep': 0.09; 'cc:addr:python-list': 0.10; 'dictionaries': 0.16; 'dimension': 0.16; 'pair,': 0.16; 'recipes': 0.16; 'singleton': 0.16; 'subject:Java': 0.16; 'wrote:': 0.17; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'wondering': 0.26; 'message- id:@mail.gmail.com': 0.27; 'loads': 0.29; 'case,': 0.29; "i'm": 0.29; 'usually': 0.30; 'code': 0.31; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'some': 0.38; 'called': 0.39; 'header:Received:5': 0.40; 'containing': 0.61; 'map': 0.61; 'fun': 0.64; 'to:addr:yahoo.co.uk': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=R0dTqvCABZF4dMMRGFIu9e9qzKiYPNTUqaznvoMUAk8=; b=mQgw3BjmR1hIk0yy7EtVoAfdxuWiAeDMQJWLtHy2UeO7XT28arbgfX4eSVatT5PP53 /Liv2zREJPMp+sdoifPzY2ZAQcvQQbPXscofThCT/d7LLLffP0Gf0mphbkiSjKJaMNno Dbrm34HsyreSEjSMLn0BbQT11B6wIP23KDc1wRkvxIgNpdjXuQLMew4ToMij2uCD5Vdz mVbzcBGkHUq/bMiE/nB6ueaoqG7HRlw0uttk9ziDp+482yYAtlnmQ4qbT7yN1YKuU6in jpFObJkzdQSHQvkv9dhb6XLF2cn6gQ8nAnw0qR8hc04b+Jt6mlbic28/1InufGtSQ3nv anpA== |
| MIME-Version | 1.0 |
| In-Reply-To | <k3o53u$8qf$1@ger.gmane.org> |
| References | <k3o53u$8qf$1@ger.gmane.org> |
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | Mon, 24 Sep 2012 15:22:07 -0400 |
| Subject | Re: Java singletonMap in Python |
| To | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Content-Type | text/plain; charset=UTF-8 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| 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.1202.1348514570.27098.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1348514570 news.xs4all.nl 6866 [2001:888:2000:d::a6]:53578 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:29920 |
Show key headers only | View raw
On Sun, Sep 23, 2012 at 7:14 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> Purely for fun I've been porting some code to Python and came across the
> singletonMap[1]. I'm aware that there are loads of recipes on the web for
> both singletons e.g.[2] and immutable dictionaries e.g.[3]. I was wondering
> how to combine any of the recipes to produce the best implementation
The word "singleton" usually means "thing with only one item". For
example, {a} is a singleton set containing only a, and with matrices,
any dimension of size one is called a singleton dimension, and so on.
In this case, a singleton map is a map with only one key-value pair,
such as {a:b}.
The singleton design antipattern is not relevant here.
-- Devin
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Java singletonMap in Python Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-09-24 15:22 -0400
csiph-web