By convention, the thinobject scheme uses the special prefix characters ``@'' and ``%'' to indicate ``list'' or ``dictionary'' properties, respectively, within a class or object. Under this convention, @list would be a file containing one arbitrary entry per line, and %dict would be a file containing lines of ``tag = value'' pairs.
In the thinob or tob ``enabler'' (or dispatcher), I added a search for matching list or dictionary properties if the method name is not otherwise matched (and before the search for a _default method). Given the command invocation:
tob ob.foobar
and in the absence of a method of that name, the property names ``@foobar'' and ``%foobar'' are searched for, and if found, the contents of the property (file) are displayed.
Those actions are currently done in-line in the thinob/tob enabler, but it might make sense to provide explicit accessor methods, e.g., in BaseClass, and support more operations. Currently, arguments can be provided to view specific list lines or dictionary entries, e.g.,
tob ob.mylist 1,2,10..20
tob ob.mydict name address phone
would display lines and entries matching those parameters.
-- Ken
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By convention, the thinobject scheme uses the special prefix characters ``@'' and ``%'' to indicate ``list'' or ``dictionary'' properties, respectively, within a class or object. Under this convention, @list would be a file containing one arbitrary entry per line, and %dict would be a file containing lines of ``tag = value'' pairs.
In the thinob or tob ``enabler'' (or dispatcher), I added a search for matching list or dictionary properties if the method name is not otherwise matched (and before the search for a _default method). Given the command invocation:
tob ob.foobar
and in the absence of a method of that name, the property names ``@foobar'' and ``%foobar'' are searched for, and if found, the contents of the property (file) are displayed.
Those actions are currently done in-line in the thinob/tob enabler, but it might make sense to provide explicit accessor methods, e.g., in BaseClass, and support more operations. Currently, arguments can be provided to view specific list lines or dictionary entries, e.g.,
tob ob.mylist 1,2,10..20
tob ob.mydict name address phone
would display lines and entries matching those parameters.
-- Ken