[Y-devel] And now for something completely different

Jerome Laheurte jerome at gandalf.fraca7.homeunix.net
Sun Feb 22 19:53:46 GMT 2004


On Sun, 22 Feb 2004, Kannan Vijayan wrote:

> On Sunday 22 February 2004 7:27 am, Jerome Laheurte wrote:
> > Hello everybody. The Python binding for Y is ready!

> Question (havn't pulled it down yet): does it sit on top of libYc++, or does
> it implement the protocol natively in python?

There are two parts:

* The low-level binding implements basic message operations
(invoke/find class/etc...); it's written in C and made available to
Python through the modY module. Very basic, indeed. Uses libY. It
could be seen as an implementation of the Y protocol in C, but rather
Python-biased.

* The high-level binding reads class descriptions from an XML file and
creates Python classes in the module namespace, taking care of
necessary translations, creating method/property objects as attributes
of the newly generated classes so that everything happens
transparently. Python introspection capabilities came in handy here.

The 0.1 version is rather rough, with code that could appear as Black
Magic :) but I began to include comments in 0.2...

The fact is, I'm quite lazy. Relying on libYc++ for a binding, let's
say through SWIG, would have been quite difficult, compared with this
rather simple scheme. Right now, every time someone adds a widget to
the Y core, I just have to write a few lines of XML to support it, and
get back to reading /. or some other time-loosing site.

-- 
Jérôme Laheurte <fraca7 at free.fr>
As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality.
                -- Albert Einstein



More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved