descriptors/massproduced.py
def create_init(attrs):
    """Create an __init__ method that sets all the attributes
    necessary for the function the Descriptor invokes to check the
    value.

    """
    args = ", ".join(attrs)
    vals = ", ".join(['getattr(self, "{}")'.format(attr) for attr in attrs])
    attr_lines = "\n    ".join(
        ["self.{attr} = {attr}".format(attr=attr) for attr in attrs])
    init_code = """def _init(self, {args}):
    super(self.__class__, self).__init__()
    {attr_lines}
    self.field_type += "({{}})".format(
        ", ".join([str(val) for val in [{vals}]]))
    """.format(args=args, attr_lines=attr_lines, vals=vals)
    exec(init_code, globals())
    return _init
def create_init(attrs):
    """Create an __init__ method that sets all the attributes
    necessary for the function the Descriptor invokes to check the
    value.

    """
    args = ", ".join(attrs)
    vals = ", ".join(['getattr(self, "{}")'.format(attr) for attr in attrs])
    attr_lines = "\n    ".join(
        ["self.{attr} = {attr}".format(attr=attr) for attr in attrs])
    init_code = """def _init(self, {args}):
    super(self.__class__, self).__init__()
    {attr_lines}
    self.field_type += "({{}})".format(
        ", ".join([str(val) for val in [{vals}]]))
    """.format(args=args, attr_lines=attr_lines, vals=vals)
    exec(init_code, globals())
    return _init
Create an __init__ method that sets all the attributes
    necessary for the function the Descriptor invokes to check the
    value.