On 02/24/2013 12:29 PM, Michael Torrie wrote:
> I think he's maintaining existing code. It's unfortunate that his first > exposure to python is code written by someone else in such a poor style, > and in a way that definitely isn't pythonic. No wonder he's struggling > to like python! Though I'm sure since his recent experience has been > exclusively in C# that he probably uses hungarian notation as a matter > of course. A hard habit to break! Is this a good time to introduce him > to duck typing? Probably not. > > Another way to explain the double underscore methods is that they are > how things like operator overloading is performed. Want to make a class > that you can use the [index] notation on instances? Define the > __get_attr__() method. And to define a class that you can then use small correction: it should be __getattr__() -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ Admiration for a quality or an art can be so strong that it deters us from striving to possess it. Friedrich Nietzsche -- http://mail.python.org/mailman/listinfo/python-list