Using attr.ib() for class member variables

434 Views Asked by At

I'm not well versed with Python (mostly use C++) and the attr module. I'm looking through my codebase at work, and I often see class attributes created as follows:

import attr

class my_class:
  first_member_var = attr.ib()
  second_member_var = attr.ib()

  def func():
    self.third_member_var = non_class_func()

In this class third_member_var was not set to attr.ib() like the first two. I'm not sure if the original developer just forgot to do this, or if there's some functional difference by doing this or not?

0

There are 0 best solutions below