Hi Ken, that's awesome many thanks - I'm not going mad after all it is just a
slightly quirky pythonism, and I've just clocked how the language got its
name :-)
Re "Not very intuitive, IMHO" for the most part I was cursing that too :-D
but upon reflection (bad pun!!) to be fair it's probably as much an issue
with me trying to read/reverse engineer code in a language that I'm
unfamiliar with.
I guess if I was familiar with python I'd have looked for the __getattr_
method pretty quickly, as it was I hadn't a clue until you enlightened me. I
guess that conceptually it's no different than say C++ operator overloading
in the sense that __getattr_ looks like a user defined object property
dereference operator. I can't really criticise python for my ignorance,
especially as I've cursed Java's lack of operator overloading many times :-)
My Java port of qpid-config would probably be half the size and a darn site
neater if I could have overloaded Map get operations as a "[]" operator!!!!
As a slight aside: given
def __getattr__(self, name):
for method in self._schema.getMethods():
if name == method.name:
return lambda *args, **kwargs : self._invoke(name, args, kwargs)
I'm guessing that this is how qpid-route can do things like
"link.bridge(....blah" in other words it's possible to write code that
transparently calls the remote object - kind of dynamic proxies on steroids.
Now that's actually quite cool and really pretty intuitive - definitely a
plus of a dynamically typed interpreted language.
Thanks again for your response
Frase
Ken Giusti wrote:
>
>
> Take a look at the function console.py::Object::__getattr_ - see the
> comment "Dereference references".
>
> Not very intuitive, IMHO.....
>
>
--
View this message in context:
http://apache-qpid-users.2158936.n2.nabble.com/qpid-config-what-does-q-altExchange-name-do-tp6591980p6605494.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]