File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Jython/Python and the fly likes OO in Python Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "OO in Python" Watch "OO in Python" New topic
Author

OO in Python

Robert Hill
Ranch Hand

Joined: Feb 24, 2006
Posts: 94
Is there any encapsulation in python objects?

There is the convention to use a single underscore to denote private members, but is not enforced in any way.

Using double underscore mangles it a bit, but is used to avoid naming conflicts.

It seems like python OO is like faking OO in C.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18563
    
    8

The forum right below this one (Object Oriented Scripting) has Python as one of its subjects. So I'll move this post down there.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8895
    
    8

Originally posted by Robert Hill:

It seems like python OO is like faking OO in C.


Yes, some of Python's object support is by convention rather than forced on you by the language, but you have to appreciate that Python is ment to be a lighter-weight language than, say Java, from a syntax point of view. If you want strict OO features, use Smalltalk. If you want to write something quick and dirty, use a scripting language. If you want a good balance between those two extremes, Python makes a good compromise.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OO in Python