[Python-Dev] defaultdict proposal round three
Fuzzyman
fuzzyman at voidspace.org.uk
Wed Feb 22 12:14:12 CET 2006
Greg Ewing wrote:
> Fuzzyman wrote:
>
>
>> cfg = ConfigObj(newfilename)
>> cfg['key'] = 'value'
>> cfg['key2'] = ['value1', 'value2', 'value3']
>> cfg['section'] = {'key': 'value', 'key2': ['value1', 'value2', 'value3']}
>>
>
> If the main purpose is to support this kind of notational
> convenience, then I'd be inclined to require all the values
> used with this API to be concrete strings, lists or dicts.
> If you're going to make types part of the API, I think it's
> better to do so with a firm hand rather than being half-
> hearted and wishy-washy about it.
> [snip..]
>
Thanks, that's the solution we settled on. We use ``isinstance`` tests
to determine types.
The user can always do something like :
cfg['section'] = dict(dict_like_object)
Which isn't so horrible.
All the best,
Michael
> --
> Greg
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060222/abd30a28/attachment.htm
More information about the Python-Dev
mailing list