Can I reference 1 instance of an object by more names ?

Stef Mientki S.Mientki-nospam at mailbox.kun.nl
Tue May 22 19:44:22 EDT 2007


hello,

I'm trying to build a simple functional simulator for JAL (a Pascal-like language for PICs).
My first action is to translate the JAL code into Python code.
The reason for this approach is that it simplifies the simulator very much.
In this translation I want to keep the JAL-syntax as much as possible intact,
so anyone who can read JAL, can also understand the Python syntax.

One of the problems is the alias statement, assigning a second name to an object.
I've defined a class IO_port,
and I create an instance of that port with the name port_D

     port_D = IO_port('D')

Now I want to assign a more logical name to that port,
(In JAL: "var byte My_New_Name IS port_D")

Is that possible ?

I think the answer is "no",
because the object itself is not mutable.
Am I right ?

But I read: "An object can have any number of names, or no name at all."
So am I wrong ?

Sorry this has been discussed before, but I'm totally confused.

thanks,
Stef Mientki




More information about the Python-list mailing list