thnx guys.
On 24.01.2014 01:10, Terry Reedy wrote:
Johannes Schneider 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 exec
Johannes Schneider 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
same module object is provided for
Johannes Schneider 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
>> same module object is pro
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 th
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 wrote:
> ChrisA
and this one is about multiclass container function with
multithreading support:
import threading
def provider(cls, x = [threading.Lock(), {}]):
provider.__def
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 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 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, http://nedb
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 wrote:
Why not simply:
def get_singleton(x = SomeClass()):
return x
Or even:
singleton = SomeClass()
? Neither of the above provides anythi
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 wrote:
>
> >
>
> > Why not simply:
>
> > def get_singleton(x = SomeClass()):
>
> > return x
>
> > Or
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 wrote:
>
> Why not simply:
> def get_singleton(x = SomeClass()):
> return x
> Or even:
> singleton = SomeClass()
> ? Neither of the above provides anything above the last one, ex
On Thu, Jan 23, 2014 at 3:07 AM, Asaf Las 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 singleton_provide
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:
singleto
12 matches
Mail list logo