On Sat, Aug 8, 2009 at 9:11 PM, kj<no.em...@please.post> wrote: > In <mailman.4446.1249683227.8015.python-l...@python.org> Chris Rebert > <c...@rebertia.com> writes: > >>The double-underscores indicate that the Python interpreter itself >>usually is the caller of the method, and as such some level of "magic" >>may be associated with it. Other languages have you do the equivalent >>of `def +():` or `def operator +()` to override an operator, the >>keyword or symbol serving a similar warning that "here be magic". > > In this case, then I hope that some of these __items__ get demoted > to a more mundane level, so that the notion of "magic" doesn't get > trivialized by everyday idioms like: > > if __name__ == '__main__': > # etc > > There are a few in this category... I figure that they are cases > of "atavistic magic". > > I bring this up because I find it quite difficult to explain to my > students (who are complete newcomers to programming) all the > __underscored__ stuff that even rank noobs like them have to deal > with. (Trust me, to most of them your reply to my post would be > as clear as mud.)
Maybe your students do not need to know about it, at least at the beginning ? I heavily use python, and do not use the underscore methods so much most of the time, except for __init__, cheers, David -- http://mail.python.org/mailman/listinfo/python-list