Why less emphasis on private data?

sturlamolden sturlamolden at yahoo.no
Mon Jan 8 18:25:39 EST 2007


Jussi Salmela wrote:

> To surlamolden: I don't know how you define private, but if one defines
> in C an external static variable i.e. a variable outside any functions,
> on the file level, the scope of the variable is that file only.

Sure, in C you can hide instances inside an object image by declaring
them static. But the real virtue of static declarations is to assist
the compiler.

My definition of 'private' for this thread is the private attribute
provided by C++, Java and C#. When I program C I use another idiom,

   /* THIS IS MINE, KEEP YOUR PAWS OFF */

and it works just as well. The same idiom works for Python as well.







> To hg: One does not need in C the static keyword to make a variable
> defined inside a function i.e. a so called 'automatic variable' private
> to that test. Automatic variables are private to their function by
> definition. The static keyword makes the variable permanent i.e. it
> keeps its value between calls but it is of course private also.
>
> To Neil Cerutti: If a programmer in C has got a pointer to some piece of
> memory, that piece is at the mercy of the programmer. There's no data
> hiding at all in this case.
>
> To whom it may concern: please stop comparing C and Python with regard
> to privacy and safety. They are two different worlds altogether. Believe
> me: I've been in this world for 2.5 years now after spending 19 years in
> the C world.
> 
> Cheers,
> Jussi




More information about the Python-list mailing list