Prothon gets Major Facelift in Vers 0.1.0 [Prothon]

Greg Ewing greg at cosc.canterbury.ac.nz
Mon May 24 01:25:12 EDT 2004


gabor wrote:
> class C
> {
> 	private x;
> };
> 
> so, how can you write to that variable from the outside?

You write your own .h file which is exactly the same
except that it doesn't say "private".

This probably isn't any safer than casting, but the
point is, if you're going to these lengths you know
what you're trying to do and probably have a good
reason for it. Exactly the same thing applies to
Python name mangling. You're prevented from accidentally
messing with things, not from deliberately messing
with them.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg




More information about the Python-list mailing list