__new__ 

Send to Kindle
home » snippets » python » __new__



Snippets

class MySet(frozenset):
    def __new__(cls, *args):
        if args and isinstance (args[0], basestring):
            args = (args[0].split (),) + args[1:]
        return super (MySet, cls).__new__(cls, *args)