I don't know if this is a simple matter of RTFM, but bear with me as it was a while ago I used a statically typed language...
I'm porting some C# code to IronPython, and I just stumbled on this statement below. I'm not at liberty to post the actual code, so I'll write it in pseudo code instead:
data_type_1 variable_1 = variable_2 as data_type_2;
where
variable_2 is a COM object from earlier parts of the code, variable_1 is a new variable, and data_type_1 is a class that interacts with the data in the COM object.
What does it mean? I'm guessing it is some form of conversion. How can I convert it to something IronPython can make sense of?
The as operator is a "safe cast" operator, it converts the variable_2 to type data_type_2. If that conversion fails, it doesn't throw an exception but returns null.
Further, to be able to assign a value of data_type_2 (the result of the 'as' expression) to a variable of data_type_1, that data_type_2 must be derived from data_type_1 (or implement the interface data_type_1).
How can I translate this C# variable declaration to something IronPython can handle?