[XML-SIG] Re: [DO-SIG] Python language bidning January 2000 Draft
Mon, 26 Jun 2000 09:07:10 -0400
Let me start by explaining to the do-sig why I all of a
sudden care about mapping of IDL attributes in the Python
I'm doing alot of work with XML these days and with the
XML Document Object Model (DOM), in particular. Now,
these DOM standard, http://www.w3.org/DOM/, is specified
as an IDL interface. Further, key parts of this interface
use attributes. :( Waaaaaa.
The end result is that an important Python and Zope interface,
DOM, is substantially affected by the choice of a language mapping
for CORBA IDL attributes! This is ironic since many (most)
applications of DOM in Python will have nothing to do with
"Martin v. Loewis" wrote:
> > OK, so, given that leading '_'s traditionally indicate private
> > attributes/members in Python, *why* does the Python language
> > mapping use leading '_'s in methods generated from IDL?
> People might have two problems with that mapping, one is, why map
> attributes to methods at all (instead of mapping them to attributes);
> it seems that you are not questioning that decision - if you do, I'll
> happily elaborate on that.
I have sympathies for both points of view on that. I'm not opposed to
attributes with comptation behind them. We do this alot in Zope, however,
without alot of infrastructure, they are a royal pain in the butt to
implement, especially if you want to implement them efficiently. :)
I'd be extremely interested in hearing your view on that.
> As to the specific choice of names: get_ and set_ as prefixes are also
> not debated, right? Now, consider mapping
> readonly attribute long foo;
> def get_foo(self)
> This gives a (admittedly pedantic) opportunity to write:
> readonly attribute long foo;
> void get_foo(in string bar);
> Now, which of those should be mapped to get_foo?
I agree that this is a problem. However, if given the choice
of having to deal with this problem or creating APIs with leading
'_'s. I'd really rather just deal with this problem, especially
given the advice not to use attributes in the first place.
Note that I really don't care what spelling is used as long as
it doesn't start with '_'s. The C++ mapping seems to address
the problem above by using access functions of the same name as
> > This seems like a really bad choice to me.
> Given the alternatives (i.e. non-trivial conflict resolution
> mechanisms), this seems the best choice to me.
OK, we disagree. I think creating API's with leading underscores
is too problematic. It breaks a standard Python idiom. (And, I
admit, it goes against a Zope security rule that doesn't allow
access to names with leading '_'s. :])
> I'd rather draw another conclusion: Using attributes in IDL is a bad
> design choice. Languages need to support them, but I really consider
> them bad design. For example, you can't give errors on attribute
> access (except for system exceptions); instead of deprecating them,
> the CCM people proposed to add exception support to attributes for
> CORBA 3...
I agree, however, there is a *very* important API, that I have to deal
with, which is DOM. Many critical features in DOM are specified
as IDL attributes. With the current Python mapping, this leads to a
rather badly spelled API.
Of course, another solution would be to ignore the fact that
DOM is specifed in IDL and provide a CORBA-independent DOM API.
Jim Fulton mailto:email@example.com Python Powered!
Technical Director (888) 344-4332 http://www.python.org
Digital Creations http://www.digicool.com http://www.zope.org
Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for