# lock\_attr

Locks an attribute name from reassignment. Nothing is returned.\
\
Attribute names that are locked cannot be reassigned to a new value, but a locked attribute name can be deleted or unlocked (See [unlock\_attr](/docs/maci/object/methods/unlock_attr.md)). If there is an attempt to reassign an attribute name that is currently locked, an exception will be thrown. Attribute names must already exist to lock them.

You cannot have an attribute name locked and [hard-locked](/docs/maci/object/methods/hard_lock_attr.md) simultaneously. Only one lock type can be used on an attribute name at a time.<br>

*Basic Example of locking a name using default positional parameter*

```python
data.lock_attr('attr_name')
```

In this example, we simply lock an attribute name that already exists in the [MaciDataObj](/docs/maci/object.md) using the lock\_attr method and pass a string of the attribute name as an argument to the method to lock the name.

### partner methods

Methods that provide related utility to this method

[unlock\_attr](/docs/maci/object/methods/unlock_attr.md)  ->  Unlock an attribute name\
[get\_locked\_list](/docs/maci/object/methods/get_locked_list.md)  ->  View all the currently locked attribute names

### parameters & arguments

Describes all parameter functionality and accepted data types

<details>

<summary>attr_name:  str</summary>

First and only required positional argument. Accepts strings

Use this parameter to pick attribute name to lock

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.macilib.org/docs/maci/object/methods/lock_attr.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
