[EMAIL PROTECTED] wrote: > What do you think? The impression I get from your suggestion is that you haven't really understood Python. I'm sure that some things could be better designed or better documented, but your suggestions would actually make things worse. Sorry.
Today, Python has a syntactic shortcut. If 'a' is an instance of class 'A', a.f(x,y,z) is a shortcut for A.f(a,x,y,z). If you don't use the shortcut, there is no magic at all, just the unusual occurence of a type check in Python! If you use the shortcut, Python code looks just like most other OO languages. This isn't very magical. What you suggest doesn't remove magic, but it introduces a bunch of inconsistencies! > But: > Foo.__dict["bar"]__(1,2,3) > Does work. I agree that this isn't completely clean, and there are some other ways in which the distinction between functions, unbound methods and bound methods seem a bit quirky to me. I don't think the problem is in the syntax though, and if it had been a real problem, it would had been solved. > class Foo: > def self.bar(a,b): > return a+b > Foo().bar(1,2) => 3 First of all, you are using a really poor example of a "method", since it doesn't use any attributes of the Foo instance. That function doesn't seem to belong in that class at all. If it should be in the class, it should be a static method, so self should not be involved at all. In modern Python it would look like this: class Foo(object): @staticmethod def bar(a, b): return a+b Anyway, my impression is that you haven't fully understood how namespaces work in Python, at least not the distinction between class namespaces and instance namespaces. Please study this a bit more. Hopefully, you'll find enlightenment and things will fall into place for you. You are really giving "self" a magic meaning with your suggestion which isn't needed at all. So far, the existence of x.y somewhere in Python always implied that x was already introduced explicitly in the program, and you suggest that we violate that both in the "def self.x"-row, and inside the methods when we access attributes. Provoking a language can be a way of learning it, and provoking people can sometimes lead to new insights, but it's important to have an open mind. When learning a new language, it's probably better to try to adapt oneself to it, rather than the other way around. -- http://mail.python.org/mailman/listinfo/python-list