[EMAIL PROTECTED] wrote: > Hi all. I'm learning python these days. I'm going to use this thread > to post, from time to time, my annoyances with python.
Please start a new thread for each annoyance. Overuse of a single thread is an annoyance to a great many people. > I hope someone > will clarify things to me where I have misunderstood them. Perhaps substitute "annoyance" with "misunderstanding" to garner the friendliness of your python peers. > Annoyances: You mean "Misunderstandings:" > 1. Underscores! What's the deal with that? Especially those double > underscores. The best answer I read on this is that the double > underscores denotes special methods that the interpreter may > automatically use. For example, 4+4 get expanded by the interpreter to > 4.__add__(4). The double underscores are probably not the most aesthetic feature of the language. By the time you know how and when to use them, they will not bother you at all and so you will be scratching #1 off your list. > 2. There are modules, there are functions, and there are classes- > methods! Wouldn't it have been easier had everything either been a > function or a class method? > Do you mean "unbound methods" or "class methods"? They are essentially the same as functions unless you get into the internals of python, which means you are going out of your way to look for annoyances. Such behavior will lead to frustration and, eventually, abject ennui. So you should strike your latter point off your list of annoyances...misunderstandings. For example: py> class Thing(object): ... doit = classmethod(doit) ... py> Thing.doit(88) Param is "param". py> Thing.doit(object()) Param is "param". py> def doit(athing, param): ... print 'Param is "%s".' % param ... py> class Thing(object): ... doit = doit ... py> t = Thing() py> t.doit(4) Param is "4". If your latter misunderstanding is about the lack of actual class methods, then consider: py> class Thing(object): ... doit = classmethod(doit) ... py> Thing.doit(4) Param is "4". James -- http://mail.python.org/mailman/listinfo/python-list