Change in a Dictionary affects all instances of a scene - is it a bug or supposed behavior?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Klagsam

I have a scene called LandTile - which is my Template. My GameMap is made of several scenes of LandTile which inherit from the original scene (the template) with this piece of code:

func create_map(width : int = size.x, height : int = size.y ): #a 2D Array with a LandTile in each cell
var a = []

for x in range(width):

	for y in range(height):

		var lt = load("res://LandTile.tscn")
		var lti = lt.instance()

and everything works as expected so far.
Now I added two variables to LandTile:

var harvest : Dictionary 
var defense : int

Then I have 2 functions:

func set_defense (amount : int):
if amount > 0 :
	defense = amount
func set_harvest(resEnumArray : Array, amountArray : Array):
if resEnumArray.size() == amountArray.size():
	for i in range (resEnumArray.size()):

Now if I call
I get what i expect: just specialLandTile has a defense value of 2, all others have 0.

However: If i call specialLandTile.set_harvest([1,2,3][3,3,3])
I do get {1:3, 2:3, 3:3}
on ALL my landTiles, i.e. if I add to an empty Dictionary the way I do it, the Dictionary is changed in all instances. Is that supposed to be like that or is it a bug?
And: Has anybody an idea for a workaround?

:bust_in_silhouette: Reply From: Klagsam

I got the answer myself.
I have to declare
var harvest : Dictionary = {} WITH the brackets in the declaration.