Re: [Opencxx-users] Re: refining the Synopsis APIs
Stefan Seefeld <[email protected]>
| Newsgroups | gmane.comp.documentation.synopsis |
|---|---|
| Message-ID | <[email protected]> |
Nathaniel Smith wrote:
> On Tue, Nov 02, 2004 at 12:35:31PM +0400, Vladimir Prus wrote:
>
>><aside>
>>Isn't
>> def __init__(self, files=None, declarations=None, typedict=None):
>> """Constructor"""
>>
>> if files is None: files = {}
>>
>>reduntant? What about
>>
>> def __init__(self, files={}, declarations=None, typedict=None):
>> """Constructor"""
>>
>></aside>
>
>
> No, in the latter case, the {} would be evaluated only once, and only
> one dict would be constructed; all default-initialized objects would
> end up sharing the same .files dict.
heh, you are quite right ! What a pitfall...thanks for pointing it out :-)
Stefan