Iyer, Prasad C wrote: > How do I serialize the object color without serializing the x and > somechar variables? > Is there any modifier which prevents the variable from being serialized. > See the pickle documentation. The example given in the documentation pickles a class while excluding one of its attributes.
http://www.python.org/doc/2.4.2/lib/pickle-example.html > Another question: > Is there a concept of private variables? 'private variables' can mean either of two things: hiding the variables to prevent accidental naming conflicts in subclasses, or security to prevent malicious manipulation of a class's internal state. Python provides the former (to a certain extent) when you give an attribute a name prefixed with a double underscore, but makes no attempt to provide the latter. Some other languages (such as C++) make no attempt to provide the former and a completely inadequate attempt at the latter. In other words: Python has a concept of private variables, but it is different than in some other languages, and if you google past threads you can find endless discussions on the pro's and con's of the Python approach. -- http://mail.python.org/mailman/listinfo/python-list