Re: RE: [Tutor] Accessing the name of an instance variable

Magnus Lycka magnus at thinkware.se
Tue Nov 25 10:49:01 EST 2003


> ah, yes. But the point of it all is to get the actual variable name.

But an object doesn't have a variable name. The name
is just what someone on the outside calls the object.

a = DiseaseCode(['1371','137L','137P0','137S','137T'])
b = a
c = b

Now you have three names for the same object. Different
names might occur in different scopes. The global scope
should be avoided as much as possible, and the local scopes
are just that--local. They are meaningless outside the
functions or classes where they are defined. Object might
also exist without being directly referenced by variables.

l = []
l.append(DiseaseCode(['1371','137L','137P0','137S','137T']))

I think you need to rethink this. I'm sure you can make
something that will do what you intended for globals in a
module, but I'm pretty sure this will become useless as 
your system grows.



-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus at thinkware.se



More information about the Tutor mailing list