Skip to content

attr.ib converter function args issue #1112

@wandth

Description

@wandth

hello, when I try to converter some class members such as that

import attr

def new_converter(value):
    return " -rl " + value

@attr.s()
class Test(object):
    test_mem = attr.ib(default=None, converter = new_converter)

info = Test(test_mem="2222")

print("--->", info.test_mem)

that was all right

but when I do wrote those code

def new_converter(value):
    return " -rl " + value

@attr.s()
class Test(object):
    test_mem = attr.ib(default=None, converter = new_converter)

# info = Test(test_mem="2222")
info = Test()
info.test_mem = "2222"  # ----------> this is wrong

print("--->", info.test_mem)

the code was wrong
image

is that problem a requirement for code or a bug ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions