Il 16/07/2013 14:04, Amos Kong ha scritto: >> > Thanks. I see this is unique, but it is also not too intuitive. >> > >> > So, could you add a "kind" field to DataObject that is an enum >> > (list/dict/scalar, or something like that)? This would make it easier >> > to parse (for humans at least, but I guess also for programs). > I thought we can identify the kind by some judgment.
Yes, I understood that. Strictly speaking the kind is redundant, but it seems to me that it makes the API easier to understand and use. > if the dict has key 'key', it's a dict > if no 'key', have 'type', it's a list > if only have 'type', it's a buildin type (or extended type that > doesn't need to be extended) > if no 'key', have 'type' & 'data', it's extended list type > if have 'key', 'type', 'data', it's extended dict type > > I will added a 'kind' field to make it clearer. > > KIND enum: > list > dict > str Why "str" and not "scalar" for a builtin type? It's not necessarily a string, is it? Paolo > scalar(bool): Or just simplely check if have 'data' key? > true/false