Skip to content

Minor inconsistency in Documentation #122463

@mdeiana

Description

@mdeiana

Documentation inconsistency

Hey how's it going, there's a small mistake in this page where the paragraph you may find at the bottom mixes up "mutable" and "immutable", stating that altering objects of immutable type may return a reference to an existing object and then states that for mutable objects this is not allowed.

You may find the original paragraph and my proposed changes at the bottom.

May I also suggest editing the sentence "Even the importance of object identity is affected" to something more direct like "Type may even alter how an object's identity is handled"? I won't include that in the changes, but I believe it would be more clear.

The original paragraph:

Types affect almost all aspects of object behavior. Even the importance of object identity is affected in some sense: for immutable types, operations that compute new values may actually return a reference to any existing object with the same type and value, while for mutable objects this is not allowed. E.g., after a = 1; b = 1, a and b may or may not refer to the same object with the value one, depending on the implementation, but after c = []; d = [], c and d are guaranteed to refer to two different, unique, newly created empty lists. (Note that c = d = [] assigns the same object to both c and d.)

My proposed changes:

Types affect almost all aspects of object behavior. Even the importance of object identity is affected in some sense: for mutable types, operations that compute new values may actually return a reference to any existing object with the same type and value, while for immutable objects this is not allowed. E.g., after a = 1; b = 1, a and b may or may not refer to the same object with the value one, depending on the implementation, but after c = []; d = [], c and d are guaranteed to refer to two different, unique, newly created empty lists. (Note that c = d = [] assigns the same object to both c and d.)

Thanks goodbye

This is my first time submitting an Issue so please let me know what I've done wrong. Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions