Python Oddity - print a reserved name
Duncan Grisby
duncan-news at grisby.org
Thu Sep 16 07:55:08 EDT 2004
In article <m3acvr8sff.fsf at pc150.maths.bris.ac.uk>,
Michael Hudson <mwh at python.net> wrote:
>aleaxit at yahoo.com (Alex Martelli) writes:
>
>> This kind of thing, however, is also true of CPython whenever it's
>> accessing "outside" objects through attributes; and for .NET
>> implementations I believe that CLR compliant languages are not
>> allowed to forbid certain method names along their interfaces to
>> other components. I'm not sure how CORBA's standard Python bindings
>> address the same problem, how it's met in various interfaces to
>> XML-RPC, COM, SOAP, and other distributed-objects or foreign-objects
>> APIs.
>
>I'm fairly sure the approach taken by CORBA bindings is the good old
>"append an underscore" hack. I don't know what happens if an
>interface declares methods called both "print" and "print_", but
>giving the author a good kick seems an appropriate response...
CORBA prepends an underscore, so it would use "_print". Identifiers in
CORBA IDL are not permitted to start with an underscore, so there is
no possibility of a clash with another IDL defined identifier. If the
Python mapping appended an underscore for clashes, it would be
susceptible to the issue you mention.
Cheers,
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the Python-list
mailing list