Perspective: Setting property to dictionary in script appends rather than replaces

I found the issue. It was with the tags.browseTags() function I was using (System.tag.browse OR in filter). I was calling the function without setting the 3rd argument to a blank list, which meant that its results were being appended to the last results each time it was called. I don’t really understand why this value would still even exist though across calls??

def browseTags( path='[default]', filter={}, resultaat=[] ):
	# see system.tag.browse() doc
	
	# Call the browse function for folders, do not use the filter
	results = system.tag.browse( path, {} )
#	results = system.tag.browse( path, {'tagType':'Folder'} or {'tagType':'UdtInstance'} ) # does not work
	for result in results.getResults():
		fullPath = str( result['fullPath'] )
		if result['hasChildren'] == True: # recursive call when folder or UdtInstance
			resultaat = browseTags( fullPath, filter, resultaat )
        
	# Call the browse function voor tags, use filter
	results = system.tag.browse( path, filter )
	for result in results.getResults():
		fullPath = str( result['fullPath'] )
		if result['hasChildren'] == False and fullPath.find( '_types_' ) == -1: # if not a tag-type then store
			resultaat.append( fullPath ) 
	
 	return resultaat