Re: [Opencxx-users] Re: refining the Synopsis APIs

Nathaniel Smith <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
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.

-- Nathaniel

-- 
Damn the Solar System.  Bad light; planets too distant; pestered with
comets; feeble contrivance; could make a better one myself.
  -- Lord Jeffrey
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.