thnx guys.
On 24.01.2014 01:10, Terry Reedy wrote:
Johannes Schneider johannes.schnei...@galileo-press.de Wrote in
message:
On 22.01.2014 20:18, Ned Batchelder wrote:
On 1/22/14 11:37 AM, Asaf Las wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times
On 22.01.2014 20:18, Ned Batchelder wrote:
On 1/22/14 11:37 AM, Asaf Las wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times you import them, they are only executed once, and the
same module object is provided for each import.
I'm not sure, if this is
Johannes Schneider johannes.schnei...@galileo-press.de Wrote in
message:
On 22.01.2014 20:18, Ned Batchelder wrote:
On 1/22/14 11:37 AM, Asaf Las wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times you import them, they are only executed once, and the
Johannes Schneider johannes.schnei...@galileo-press.de Wrote in
message:
On 22.01.2014 20:18, Ned Batchelder wrote:
On 1/22/14 11:37 AM, Asaf Las wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times you import them, they are only executed once, and
Hi
Inspired by Modifying the default argument of function
https://groups.google.com/forum/#!topic/comp.lang.python/1xtFE6uScaI
is it possible to create singleton using construct below :
def singleton_provider(x = [None]):
if singleton_provider.__defaults__[0][0] == None:
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las roeg...@gmail.com wrote:
is it possible to create singleton using construct below :
def singleton_provider(x = [None]):
if singleton_provider.__defaults__[0][0] == None:
singleton_provider.__defaults__[0][0] = SomeClass()
return
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote:
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las r@gmail.com wrote:
Why not simply:
def get_singleton(x = SomeClass()):
return x
Or even:
singleton = SomeClass()
? Neither of the above provides anything above the last
On Thursday, January 23, 2014 12:37:36 AM UTC+8, Asaf Las wrote:
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote:
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las r@gmail.com wrote:
Why not simply:
def get_singleton(x = SomeClass()):
return x
Or
On 1/22/14 11:37 AM, Asaf Las wrote:
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote:
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las r@gmail.com wrote:
Why not simply:
def get_singleton(x = SomeClass()):
return x
Or even:
singleton = SomeClass()
? Neither of the above
On Wednesday, January 22, 2014 9:18:19 PM UTC+2, Ned Batchelder wrote:
Chris is right here, too: modules are themselves singletons, no matter
how many times you import them, they are only executed once, and the
same module object is provided for each import.
Ned Batchelder,
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote:
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las r...@gmail.com wrote:
is it possible to create singleton using construct below :
def singleton_provider(x = [None]):
if singleton_provider.__defaults__[0][0] == None:
On Wednesday, January 22, 2014 6:18:57 PM UTC+2, Chris Angelico wrote:
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las r...@gmail.com wrote:
ChrisA
and this one is about multiclass container function with
multithreading support:
import threading
def provider(cls, x = [threading.Lock(), {}]):
12 matches
Mail list logo