Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Java singletonMap in Python

Reply
Thread Tools

Re: Java singletonMap in Python

 
 
Mark Lawrence
Guest
Posts: n/a
 
      09-24-2012
On 24/09/2012 20:22, Devin Jeanpierre wrote:
> On Sun, Sep 23, 2012 at 7:14 PM, Mark Lawrence <(E-Mail Removed)> 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
>


Java thinks so otherwise there wouldn't also be the singleton which is
the spelling for singletonSet (don't ask me!!!) and a singletonList.
From the Python viewpoint I think YAGNI is perfect. I now understand
why the BDFL and others fight so hard to keep bloatware out of the
standard library.

--
Cheers.

Mark Lawrence.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java singletonMap in Python Mark Lawrence Python 5 09-25-2012 04:38 AM
Re: Java singletonMap in Python Devin Jeanpierre Python 0 09-24-2012 07:22 PM
hey i am just started java,, can anyone tell me the use ,application, why java , importance of java.. manish sahu Java 3 02-14-2008 12:00 AM
[JAVA] [EVALUATION] - The Java Failure (Sorry: The Java(tm) Failure) Ilias Lazaridis Java 0 02-01-2005 10:32 AM
Job to convert Java App 1.3.1 to Java Newest of Java Michael Kintner Java 0 11-30-2003 04:42 AM



Advertisments