Seems like the latest version of arcpy has added a ParameterArray container for parameters! I can't seem to find the documentation for it, but it definitely adopts the string based indexing that I've been using for years now haha. Glad to see that this is finally being added officially, but it would be nice to have some documentation on how the parameters are accessed by string (name, displayName, either, case sensitive, etc.).
Additionally, is this something that I have to explicitly create? Or does the getParameterInfo function return this by default? It's not implemented in Python, so knowing if I need to explicitly cast to this would be nice. Here's my sample with the explicit construction:
from typing import Any
from arcpy import Parameter, ParameterArray
class Tool:
def getParameterInfo(self) -> ParameterArray:
return ParameterArray(
[
Parameter(name='my_parameter', displayName='My Parameter')
]
)
def execute(self, parameters: ParameterArray, messages: Any) -> None:
by_name = parameters['my_parameter']
by_display = parameters['My Parameter']
by_case_insensitive = parameters['MY_PARAMETER'] or parameters['my parameter']