Skip to content

Disallow access of private members #3245

@MartinBernstorff

Description

@MartinBernstorff

I'm not deep enough in type theory to know if this is related, but I'd love if pyrefly had an option to enforce that you cannot access private members, e.g.:

class MyClass:
    _private_field: int

    def _private_method(self) -> None:
        pass


MyClass()._private_field # Should error
MyClass()._private_method() # Should error

Originally posted by @MartinBernstorff in #1126

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-discussionAn issue where it's not clear whether there is a bug or we are behaving as expected.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions