Noob Q: subclassing or wrapping file class

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Wed Sep 16 23:24:30 EDT 2009


On Wed, 16 Sep 2009 23:06:18 +0000, kj wrote:

>>Instead of:
> 
>>x.__getattr__('name')
> 
>>write this:
> 
>>getattr(x, 'name')
> 
> This did the trick.


For the record, it's fairly unusual to call double-underscore special 
methods directly. Any time you think you need to, it's worth a rethink.



-- 
Steven



More information about the Python-list mailing list