Why less emphasis on private data?
Thomas Ploch
Thomas.Ploch at gmx.net
Sun Jan 7 09:52:00 EST 2007
More information about the Python-list mailing list
Sun Jan 7 09:52:00 EST 2007
- Previous message (by thread): Why less emphasis on private data?
- Next message (by thread): Why less emphasis on private data?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jorgen Grahn schrieb: > On 06 Jan 2007 17:38:06 -0800, Paul Rubin <http> wrote: >> "BJörn Lindqvist" <bjourne at gmail.com> writes: >>> It is given that emphasizing private data (encapsulation) leads to >>> more internal complexity and more lines of code because you have to >>> write getters and setters and stuff. >> You can have public variables in Java if you choose to. Writing >> private variables with public setters and getters is just a style choice. > > Privates with getters/setters are (as I think someone else hinted) pretty > pointless. The interesting stuff is the private data that *is* private, i.e. > not meant for users at all. Not really pointless, since you can hide your data structures that you don't want to be fiddled around with (which for me is almost the only point to use it). > But yes, I don't mind not having 'private:' in Python. I don't have > compile-time type checking anyway. In fact, I don't always know what the > attributes of my objects /are/ until runtime. Me neither, although I have to say that the '__' prefix comes pretty close to being 'private' already. It depends on the definition of private. For me, private means 'not accessible from outside the module/class'. Thomas
- Previous message (by thread): Why less emphasis on private data?
- Next message (by thread): Why less emphasis on private data?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list