Prev: multiprocessing module
Next: accessing gmail
From: Red Forks on 15 Dec 2009 07:19 I don't know it is a feature, or implement detail: >>> class C(object): pass .... >>> c = C() >>> setattr(c, ' ', 3) >>> getattr(c, ' ') 3 >>> setattr(c, 'with blank', 4) >>> getattr(c, 'with blank') 4 getattr / setattr seems treat any string as attribute name.
From: Stefan Behnel on 15 Dec 2009 08:20 Red Forks, 15.12.2009 13:19: > I don't know it is a feature, or implement detail: > > >>> class C(object): pass > ... > >>> c = C() > >>> setattr(c, ' ', 3) > >>> getattr(c, ' ') > 3 > >>> setattr(c, 'with blank', 4) > >>> getattr(c, 'with blank') > 4 > > getattr / setattr seems treat any string as attribute name. Feature. We're all adults. Stefan
|
Pages: 1 Prev: multiprocessing module Next: accessing gmail |