Generic dictionary
Peter Otten
__peter__ at web.de
Mon Nov 21 08:01:27 EST 2016
Thorsten Kampe wrote:
>> def GenericDict(dict_or_items):
>> if isinstance(dict_or_items, dict):
>> return dict(dict_or_items)
>> else:
>> return SimpleGenericDictWithOnlyTheFalseBranchesImplemented(
>> dict_or_items
>> )
>
> That would be a kind of factory function for the class?
Yes, one if...else to pick a dedicated class instead of one if...else per
method in the all-things-to-all-people class.
More information about the Python-list
mailing list