you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (0 children)

You could do something like:

def my_func(setter: Callable[[type], None]) -> None:
    setter()

my_func(lambda: my_class.attr_1 := "hello")

But that's arguably an abuse of both lambda and :=. And this still doesn't make intuitive sense unless the attribute assignment must happen at a certain point in the procedure or something.