Re: Java singletonMap in Python

Discussion in 'Python' started by Devin Jeanpierre, Sep 24, 2012.

  1. On Sun, Sep 23, 2012 at 7:14 PM, Mark Lawrence <> 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
     
    Devin Jeanpierre, Sep 24, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Kintner
    Replies:
    0
    Views:
    880
    Michael Kintner
    Nov 30, 2003
  2. Ilias Lazaridis
    Replies:
    0
    Views:
    630
    Ilias Lazaridis
    Feb 1, 2005
  3. manish sahu
    Replies:
    3
    Views:
    1,050
  4. Mark Lawrence

    Java singletonMap in Python

    Mark Lawrence, Sep 24, 2012, in forum: Python
    Replies:
    5
    Views:
    254
    Dwight Hutto
    Sep 25, 2012
  5. Mark Lawrence

    Re: Java singletonMap in Python

    Mark Lawrence, Sep 24, 2012, in forum: Python
    Replies:
    0
    Views:
    195
    Mark Lawrence
    Sep 24, 2012
Loading...

Share This Page