A pointer or a copy

If I do this:
image
Will user_artifacts_copy be a pointer to user_artifacts or a copy of it? (user_artifacts is a list of a list of strings if that is relevant)

hihi I did a test and I believe it’s just a pointer (/ shallow copy)

This was my test:

I only changed one of the arrays but both of them printed out the same thing

1 Like

I agree.

1 Like

Thank you! That’s why it wasn’t working…

Is there a block for a deep copy? Or will I have to do something like this:

# Python, since I don't know TypeScript well enough
user_artifacts_copy = []
for element in user_artifacts:
    user_artifacts_copy.append(element)

hmmmmm I think you’ll have to implement your own copy >>

I should add this to joey’s util extension!

1 Like

Do you know where is the link to the Github repo? You are always using it on streams but I never remember the URL. :sweat_smile:

2 Likes

ahahaha you’re not alone. I thought I could find it by guessing but I ended needing to scroll through our chat to find it XD

here it is!

1 Like