viewTemplate_List = ["- Lost Views (Floor Plans) -", "- Lost Views (Ceiling Plans) -"]
for i in dictFloorPlanViews.values():
viewTemplate_List.append(i)
for i in dictCeilingPlanViews.values():
viewTemplate_List.append(i)
viewTemplate_List = set(viewTemplate_List)
I append a list together and put it into a set to remove duplicates from my floor and ceiling dictionary values then run this threw a function. Inside the function is the typical convert to list:
Example 1
if not isinstance(argViewTemplateNames, list):
argViewTemplateNames = [argViewTemplateNames]
I don’t think the above code is converting the set to a list while the second example does:
Example 2
if not isinstance(argViewTemplateNames, list):
argViewTemplateNames = list(argViewTemplateNames)
If I feed the below code to example number one, it works.
viewTemplate_List = list(set(viewTemplate_List))
What’s the main difference between calling list() and just using [ ] to create a list and why one works while the other does not?
Thanks