Talk:Factory (object-oriented programming)

Latest comment: 4 years ago by Antchal in topic Incorrect code of function
edit

In the phrase "concrete type", the word 'concrete' has been wikified, but this links it to the page concrete, which is hardly appropriate. It's not quite clear what article it should link to; the nearest I can come up with is Abstraction_(computer_science), which unfortunately doesn't mention the antonym 'concrete' until the 'Considerations' section. For now, I've pointed it at the disambiguation page. 131.111.202.32 (talk) 11:44, 18 January 2011 (UTC)Reply

A

Incorrect code of function

edit

Functions don't have attributes (at least in Python). So, f.obj is incorrect here.

def f():
    if f.obj is None:
        f.obj = A()
    return f.obj

PS: I don't know singleton pattern so can't edit the implementation.Antchal (talk) 09:06, 29 June 2021 (UTC)Reply