Ray wrote: > Yeah, I know... but the thing is that it's easy to "do it". Say in C++, > you can rebind the method of a class to another function if you want > to, you can muck around with the vtable and stuff, but you've gotta do > something different than, say, a normal assignment.
But remember, at no point did they think to make that stuff deliberately hard so that it would give you safety. It's hard because the implementation is relatively complex. The flipside of that is writing function objects in C++, which are an ugly hack to get around the fact that you can't just assign functions or define them in-place in that language. Python makes it trivial by comparison. And as another example, if you use the STL in C++ regularly, you will be familiar with the hoops you have to jump through in order to use generic functions. eg. try to call a polymorphic member function on each pointer in an std::map, while passing a fixed parameter to that function... this sort of thing is trivial in Python as a side-effect of the fact that the attributes are looked up at run-time. -- Ben Sizer -- http://mail.python.org/mailman/listinfo/python-list