Can't declare variable type in function

Is there a reason why pyrevit/revit can’t handle this?
i want to secure areascheme_code as a string, to my knowledge this is simple python syntax…

def RtA_boundaries(doc, areascheme_code: str):

Can you clarify exactly what the issue is? I assume you are talking about the type hinting for the function.

IronPython does not support type hinting using that syntax. Type hinting was only added into python in 3.5, so you would need to use the CPython engine in pyrevit for that to work. However, CPython is not as supported as IronPython in pyrevit.

If you want to use type hinting for pyrevit scripts you need to use the old syntax for type hinting.

def RtA_boundaries(doc, areascheme_code):
    # type: (Document, str) -> object
2 Likes