Skip to content

Instantly share code, notes, and snippets.

@JokerMartini
Created December 14, 2015 13:04
Show Gist options
  • Save JokerMartini/2fce84213e9a1c7aa222 to your computer and use it in GitHub Desktop.
Save JokerMartini/2fce84213e9a1c7aa222 to your computer and use it in GitHub Desktop.
Python: This example demonstrates how to collect common elements found in multiple lists.
list1 = [1,2,3,4,5,6]
list2 = [3, 5, 7, 9]
results = list(set(list1).intersection(list2))
print results
BLOCK_VALIDATION_DICT = {
"Faction" : [
"Note Properties" ,
"ID Properties",
"Wirecolor Properties"
],
"FactionLink" : [
"Object Properties",
"Vray Properties",
"Material Properties",
"Atmospheric Properties",
"Light Properties",
"Note Properties",
"Wirecolor Properties",
"ID Properties"
],
"Camera" : [ "Note Properties" ],
"Pass" : [
"Note Properties" ,
"Wirecolor Properties"
],
}
blocks = ["Faction","Pass"]
def get_block_attributes(block_names=[]):
valid_attributes = []
if block_names:
valid_attributes = BLOCK_VALIDATION_DICT.get( block_names[0] )
for block_name in block_names[1:]:
attribute_names = BLOCK_VALIDATION_DICT.get(block_name)
valid_attributes = list(set(valid_attributes).intersection(attribute_names))
print valid_attributes
return valid_attributes
get_block_attributes(block_names=blocks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment