can someone explain?

=?X-UNKNOWN?Q?Pastula_Pawe=B3?= pawelp at softsystem.pl
Mon Feb 17 13:56:41 EST 2003


> When you do a "val += 1", you're creating a new integer
> object which has a value (val+1) and assigning it's
> "address" (or it's reference, as it's known in this
> group) to the name "val".

Yes it makes sense. I just thought that integer values are treated
differently (like in Java).
Does it mean that there are only 2 ways of changing a value in a function?
1st: return val+1
2nd: to place a value in a class and then pass instance of this class to e
function.
Is it correct?

Thanks a lot for a reply. It was helpful.

There is still one thing I'm thinking about.
Why did Python authors abandoned encapsulation in classes?
public, private and protected modifiers are quite useful, and what's the
most important, make debugging much easier and faster.

Once again, thank you.

Cheers
Pablo






More information about the Python-list mailing list