PythonScanClient / PyScanClient

Python Client for CS-Studio Scan Service
Eclipse Public License 1.0
3 stars 4 forks source link

Use __repr__/toCmdString that's valid python #9

Closed kasemir closed 9 years ago

kasemir commented 9 years ago

See 72c856a83d6dd538d6832027bf335f5ee3a70c30:

Comment used to print as

Comment(Comment='Hello')

Now it's

Comment(Comment='Hello')

which is shorter plus valid python code that could be pasted in a python shell.

Similar: Parallel command prints for example as

Parallel()
Parallel(Comment('One'))
Parallel(Comment('One'), Comment('Two'))
Parallel(Comment('One'), Comment('Two'), timeout=10)
Parallel(Comment('One'), Comment('Two'), errHandler="MyHandler")

which is quite short, readable and represents valid constructor calls.

For the Set command, note the handling of string vs. numeric value:

Set(device='some_device',value=3.14)
Set(device='some_device',value='Text')

All commands should use that as their __repr__(), and unless we find a good reason, the toCmdString() should be the same.