Iman Sorati Ashtiani’s Post

In Java, private means private. In Python, it means: “I trust you not to look.” I was exploring encapsulation and discovered something interesting. In Java, access is enforced. In Python, it’s… negotiated. A double underscore (__attr) doesn’t truly hide anything. It just renames it. Which means: You *can* still access it — if you know how. That realization changed how I think about class design. Java protects the code. Python trusts the developer. Two different philosophies. Which one do you prefer? 👇 Curious to hear your perspective #Python #Java #OOP #SoftwareEngineering #LearningInPublic

One more thought: In Python, encapsulation is about communication. In Java, it’s about restriction. That difference is subtle… but powerful.

Like
Reply

To view or add a comment, sign in

Explore content categories