|
From: Cameron S. <cam...@cs...> - 2009-07-17 12:19:35
|
Michael Foord wrote:
> Cameron Stone wrote:
>> Michael Foord wrote:
>>
>>> Cameron Stone wrote:
>>>
>>>> I just found this very handy library, and I'm loving it.
>>>>
>>>> I'm using sections with options containing values that are
>>>> comma-separated lists. These lists are meant to have 4 values, some of
>>>> which can be empty.
>>>>
>>>> I have 2 questions:
>>>>
>>>> 1) I found the list_values parameter to turn off auto-conversion to
>>>> list, because it was filtering out the empty entries (and returning
>>>> lists with less than 4 entries). Is it possible to configure ConfigObj
>>>> to leave the empty entries in the list?
>>>>
>>>>
>>> What do you mean by 'empty entries'?
>>>
>> I mean the four entries look like:
>> key_string = Value1,Value2, ,Value4
>>
>
> And how should the missing entry look - it isn't an empty string (''),
> it isn't None - it just isn't there. That should probably be a syntax error.
I was thinking it should imitate string.split:
>>> "Value1,Value2,,Value4".split(',')
['Value1', 'Value2', '', 'Value4']
I'm doing it that way manually at present, but I'm not sure what the
benefit of removing the missing entries is.
> How about getting your users to put an empty string instead?
|