News for hackers. Stuff that matters.
Re:A Guide to Python's Magic Methods by njharman on Sunday March 18, 2012 @01:17AM (#3719179)
Controlling Attribute Access section is really poor. Giving poor explanation of getattr vs getattribute, wrongly recommending to not use these methods, claiming there is little use, and providing poor examples of common use cases. The biggest of which is object composition.
Re:A Guide to Python's Magic Methods by jeffjose on Sunday March 18, 2012 @09:02AM (#3719643)
I'm not sure who downvoted you, but I felt the same.

Its been a while since I've been through getattr vs getattribute pages, but I distinctly remember there's a big big difference in how you use them. I was kinda hoping the page had it, but unfortunately it didnt.

Original Author, if you're reading this - kindly do that.

Re:A Guide to Python's Magic Methods by SoftwareMaven on Sunday March 18, 2012 @01:48PM (#3720255)
__getattribute__ (new classes only!) hijacks the entire lookup machinery; every time you write instance., you will call it.

__getattr__ allows "normal" lookup (is it a method, does it exist in __dict__, etc) to be done by the VM and isn't called until you would otherwise get an AttributeError.