Troubleshooting ERROR 000989 Python syntax error from ArcGIS Field Calculator?
It might be because you're using a field name where a parameter name should go.
Instead, try something like:
def avg(paramName):
return 10
As Jason Scheirer commented, you can't use !field! inside of pre-script logic.
Pre Script Logic:
def demo(value, arg):
return value * arg
avg_miles =
demo(!hshld_2000!,10)
Note: A "trick" you can use to simplify this mess... You can use the interactive Command window in ArcMap to create and test python code (such as defining methods). Once you're get things working, you can reference a python method created in the interactive window from the Calculate Field window.