Fix Python – Automatically initialize instance variables?
I have a python class that looks like this:
class Process:
def __init__(self, PID, PPID, cmd, FDs, reachable, user):
followed by:
self.PID=PID
self.PPID=PPID
self.cmd=cmd
…
Is there any way to autoinitialize these instance variables, like C++’s initialization list? It would spare lots of redundant code.
….