Find answers from the community

Updated last year

can someone explain what the consequence

can someone explain what the consequence of setting 'in_place' to 'true' would be?

Plain Text
class MetadataExtractor(BaseExtractor):
    """Metadata extractor."""

    ...other code...

    in_place: bool = Field(
        default=True, description="Whether to process nodes in place."
    )


I've been using this class in my pipeline a lot and it's fantastic, but don't quite know what this field does. A low level explanation would be blessed ❀️

Thank you much in advance πŸ™
L
B
4 comments
Since the nodes are passed in as a list, they can either be modified in place (i.e. modifying the original list that was passed in), or they can modify copies of the original nodes (the input list remains un-touched)

This is a symptom of how things are pass-by-reference vs pass-by-value in python
ah so modifying in place would save compute but is quite dangerous in case you want to use those same nodes for another part of the program later on with the assumption that another sub process didn't alter the original state of the nodes?
You got it. But it defaults to True since in most cases modifying in place is usually fine
πŸ‘€ πŸ‘€ πŸ‘€ interestinggg...

Thank you my captain 🫑
Add a reply
Sign up and join the conversation on Discord