Questions tagged «initialization-list»


16
自动初始化实例变量?
我有一个看起来像这样的python类: class Process: def __init__(self, PID, PPID, cmd, FDs, reachable, user): 其次是: self.PID=PID self.PPID=PPID self.cmd=cmd ... 有没有办法自动初始化这些实例变量,例如C ++的初始化列表?它将节省大量冗余代码。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.