What this error means
You used parentheses () after a variable that contains a dictionary, trying to call it like a function. Dictionaries are accessed with square brackets [] or .get(), not parentheses.
Common causes
- You overwrote the
dictfunction name with a dictionary variable. - You used
()instead of[]to access dictionary values. - Confusion between function calls and dictionary access.
Example that causes the error
dict = {'name': 'Alice'} # Overwrote dict() function
new_dict = dict({'age': 30}) # TypeError: dict is now a dict, not a function
person = {'name': 'Alice'}
value = person('name') # TypeError: should be person['name']
How to fix it
Use square brackets or .get() for dictionary access:
person = {'name': 'Alice'}
value = person['name'] # OK: uses square brackets
# Or:
value = person.get('name') # OK: uses .get() method
Don't overwrite built-in names
my_dict = {'name': 'Alice'} # OK: different name
new_dict = dict({'age': 30}) # OK: dict() function still works
Remember: () for functions, [] for dicts
# Functions use parentheses:
result = some_function() # OK
# Dictionaries use square brackets:
value = my_dict['key'] # OK
# Don't mix them up:
value = my_dict('key') # TypeError!