Ben C wrote:
On 2006-04-11, Michele Simionato [EMAIL PROTECTED] wrote:
Roy Smith wrote:
snip
That being said, you can indeed have private data in Python. Just prefix
your variable names with two underscores (i.e. __foo), and they effectively
become private. Yes, you can bypass this if you
Casey Hawthorne wrote:
I think it's important not to wrongly confuse 'OOP' with ''data hiding'
or any other aspect you may be familiar with from Java or C++. The
primary concept behind OOP is not buzzwords such as abstraction,
encapsulation, polymorphism, etc etc, but the fact that your program
Michele Simionato wrote:
Roy Smith wrote:
snip
That being said, you can indeed have private data in Python. Just prefix
your variable names with two underscores (i.e. __foo), and they effectively
become private. Yes, you can bypass this if you really want to, but then
again, you can bypass
Gregor Horvath wrote:
Steven D'Aprano schrieb:
I don't know of many other OO languages that didn't/don't have
inheritance,
VB4 - VB6
VB6 has a kind of inheritance via interface/delegation. The interface
part is for subtyping, the delegation part (which has to be done
manually - yuck)
fyhuang wrote:
It seems to me that it is difficult to use OOP to a wide extent in
Python code because these features of the language introduce many
inadvertant bugs. For example, if the programmer typos a variable name
in an assignment, the assignment will probably not do what the
programmer
Ben Sizer wrote:
I think it's important not to wrongly confuse 'OOP' with ''data hiding'
or any other aspect you may be familiar with from Java or C++. The
primary concept behind OOP is not buzzwords such as abstraction,
encapsulation, polymorphism, etc etc, but the fact that your program
Roy Smith wrote:
snip
That being said, you can indeed have private data in Python. Just prefix
your variable names with two underscores (i.e. __foo), and they effectively
become private. Yes, you can bypass this if you really want to, but then
again, you can bypass private in C++ too.
fyhuang wrote:
Hello all,
I've been wondering a lot about why Python handles classes and OOP the
way it does. From what I understand, there is no concept of class
encapsulation in Python, i.e. no such thing as a private variable.
Seems you're confusing encapsulation with data hiding.
Any
I think it's important not to wrongly confuse 'OOP' with ''data hiding'
or any other aspect you may be familiar with from Java or C++. The
primary concept behind OOP is not buzzwords such as abstraction,
encapsulation, polymorphism, etc etc, but the fact that your program
consists of objects
On 2006-04-11, Michele Simionato [EMAIL PROTECTED] wrote:
Roy Smith wrote:
snip
That being said, you can indeed have private data in Python. Just prefix
your variable names with two underscores (i.e. __foo), and they effectively
become private. Yes, you can bypass this if you really want to,
On Tue, 11 Apr 2006 18:20:13 +, Casey Hawthorne wrote:
I think it's important not to wrongly confuse 'OOP' with ''data hiding'
or any other aspect you may be familiar with from Java or C++. The
primary concept behind OOP is not buzzwords such as abstraction,
encapsulation, polymorphism, etc
Michele Simionato wrote:
Roy Smith wrote:
snip
That being said, you can indeed have private data in Python. Just prefix
your variable names with two underscores (i.e. __foo), and they effectively
become private. Yes, you can bypass this if you really want to, but then
again, you can
Steven D'Aprano schrieb:
I don't know of many other OO languages that didn't/don't have
inheritance,
VB4 - VB6
--
Mit freundlichen Grüßen,
Ing. Gregor Horvath, Industrieberatung Softwareentwicklung
http://www.gregor-horvath.com
--
http://mail.python.org/mailman/listinfo/python-list
You can do this in Python as well. Check out the property built-in
function. One can declare a property with a get, set, and delete
method. Here's a small example of a read-only property.
class Test(object):
def getProperty(self):
return 0;
prop = property(fget = getProperty)
fyhuang [EMAIL PROTECTED] wrote:
I've been wondering a lot about why Python handles classes and OOP the
way it does. From what I understand, there is no concept of class
encapsulation in Python, i.e. no such thing as a private variable. Any
part of the code is allowed access to any variable in
Em Seg, 2006-04-10 às 07:19 -0700, fyhuang escreveu:
class PythonClass:
private foo = bar
private var = 42
allow_readwrite( [ foo, var ] )
You are aware that foo and var would become class-variables, not
instance-variables, right?
But you can always do:
class PythonClass(object):
fyhuang [EMAIL PROTECTED] wrote:
[ ... ] no such thing as a private variable. Any
part of the code is allowed access to any variable in any class, and
even non-existant variables can be accessed: they are simply created.
You're confusing two issues: encapsulation and dynamic name binding.
You
Hi,
fyhuang schrieb:
I've been wondering a lot about why Python handles classes and OOP the
way it does. From what I understand, there is no concept of class
encapsulation in Python, i.e. no such thing as a private variable. Any
the answer is here:
http://tinyurl.com/obgho
--
Mit
18 matches
Mail list logo