1 2 3 4 5 6 7 8 9 10 11 12 13 14 | class Student(): name = 'he' age = 0 def __init__( self , name, age): self .name = name self .age = age def do_homework( self ): print ( 'homework' ) def marking( self , score, name): self .score = score print ( self .name + str ( self .score)) |
有两个名字都是name的形参,怎么在类里面调用,用什么区别呢,如果都是self.name那会有问题吧
还是说要避免用同名的形参?