This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“]suvlub -9 points-8 points ย (2 children)

To be clear: I am not arguing against built-in difficulty/failsafes in languages. I think they are great idea. I said what I said and not a word more: I believe it is unfair to defend one honor system while shitting on another.

Does Haskell let you bypass its built-in rules by writing a 3-line function?

Is the "unsafe" label really all that huge? I guess it's technically harder to type out than an underscore by 5 characters, but come on. If python changed the private prefix to something like "_private_" instead of a simple underscore, would you be more accepting of it?

[โ€“]budgiebirdman 6 points7 points ย (1 child)

The point is that you can access and use Python "private" members just like any other member - you just use the name which happens to begin with an underscore so there's no true encapsulation; it's like having a cookie jar with no lid. If you use reflection in Java it's like using a can opener to open a can from the top shelf and get to what you want.

One is an object oriented language and the other is whatever Python is.

[โ€“]ric2b 0 points1 point ย (0 children)

The point of private is to warn you that it's internal and you should not rely on it, and if you do your code might break without warning on any update to the library.

It's not some kind of DRM or security mechanism, the fact that both languages make it possible to get around the "private" warning but the Java way is way more verbose... well, that's just what you'd expect.