Slowly but surely I am perusing the code for a greater understanding of PyDSTool.
One question I have is how args is implemented in common.py.
Why are class instances mapped to key values? Is this simply a visual addition, make it look more like structs as opposed to a python dictionary?
Do be more clear, is there any reason to write
PCargs.name = 'Rozen'
PCargs['name'] = 'Rozen'
The latter seems more pythonic . . . though I have no real vested interest in either.
Sorry I ment to write 'To be more clear'
not 'Do be more clear' ! the latter is aggressive, which was certainly not intended . . .
Not sure how to edit my posts.
We originally used dictionaries exclusively, but some users complained that putting large numbers of parameter settings using names in quotes was irritating.
That was fair enough, so the args class simply provides an alternative, struct-like syntax for the same thing. So it's entirely up to you which syntax you prefer to use. There's no efficiency loss as far as we're concerned.
The idea is that whenever an args class is used, a dictionary would also work. The args class implements pretty much every method needed to act like a dictionary...
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.