Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #29920 > unrolled thread
| Started by | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| First post | 2012-09-24 15:22 -0400 |
| Last post | 2012-09-24 15:22 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Java singletonMap in Python Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-09-24 15:22 -0400
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
|---|---|
| Date | 2012-09-24 15:22 -0400 |
| Subject | Re: Java singletonMap in Python |
| Message-ID | <mailman.1202.1348514570.27098.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web