On 05/29/2013 06:46 PM, Croepha wrote:
Is there anything like this in the standard library?

class AnyFactory(object):
def __init__(self, anything):
self.product = anything
def __call__(self):
return self.product
def __repr__(self):
return "%s.%s(%r)" % (self.__class__.__module__, self.__class__.__name__, self.product)

my use case is: collections.defaultdict(AnyFactory(collections.defaultdict(AnyFactory(None))))


I think I would scratch my head for a good half an hour if I see a string like this, so I hope there isn't anything in the standard library to do that :D
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to