Discussion (11)2
Log in or sign up to continue

Parameters aren't available in embedded python.  An easy workaround is to create a Property that reflects the parameter or to create an objectscript method to return the parameter.

I'm curious about the use case.

Thanks, @Bob Kuszewski!

The use case is the usage of class parameters in Embedded Python. They could same useful as they are in ObjectScript.

The reason to code with Embedded python as a first class citizen coding language as ObjectScript is.

Thought more about the use case:

The use case is “Better Developer Experience”.

Well put Evgeny!  I have frequently accessed parameters from within ObjectScript and as Python is a full first class citizen alongside ObjectScript then we need to be able to access parameters from within Python as well.

This works:


excellent!! thanks for confirming!

Right. But we should have a quicker way to get the parameter in our Python code.


set r = ..#MYPARAM


r = iris.cls('MyPackage.Subpackage.ClassName')._GetParameter('MYPARAM') 

doesn't seem too "developer friendly" to me wink

By the way, it varies if we're in a ClassMethod or in an instance Method. In instance we could do:

r = self._GetParameter('MYPARAM') 

which it's more acceptable...

But, in a classmethod it seems that our only chance would be the long version.

I wonder if we could translate them to Python as read-only special properties, adopting perhaps some convention in their name to avoid the conflicts in the (unusual) case that there is a parameter with same name that a property.

Yes, @Jose Tomas Salvador , this was my point.


r = iris.cls('MyPackage.Subpackage.ClassName')._GetParameter('MYPARAM'

Can be converted to:

r = iris.cls(__name__)._GetParameter('MYPARAM'

if you are in the same class.