empty classes as c structs?
Carlos Ribeiro
carribeiro at gmail.com
Mon Feb 7 19:04:07 EST 2005
On Mon, 07 Feb 2005 13:31:20 -0700, Steven Bethard
<steven.bethard at gmail.com> wrote:
> Carlos Ribeiro wrote:
> > On Mon, 07 Feb 2005 11:50:53 -0700, Steven Bethard
> > <steven.bethard at gmail.com> wrote:
> >
> >>Michael Spencer wrote:
> >>
> >>>We could use __add__, instead for combining namespaces
> >>
> >>I don't think this is a good idea. For the same reasons that dicts
> >>don't have an __add__ (how should attributes with different values be
> >>combined?), I don't think Bunch/Namespace should have an __add__.
> >
> > For entirely unrelated reasons I did it for a bunch-like class of
> > mine, and called it 'merge'. For this particular application it was a
> > better name than update and append, but that's IMHO.
>
> Did 'merge' have the same semantics as the 'update' being discussed?
> That is, did it modify the first 'bunch'? Or did it create a new
> 'bunch'? To me, 'merge' sounds more like the second...
In my particular example it was more like the second, but it doesn't
apply exactly because the goal was a little bit different; I
implemented it to merge two configuration dictionaries, one being the
'base' (with default values) and the other one with values to
overrride the base values. Anyway, it was just a suggestion; and while
I don't think that merge really implies one behavior over the other,
having it as a constructor does make sense...
--
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com
More information about the Python-list
mailing list