STL multimap

castironpi at gmail.com castironpi at gmail.com
Mon May 5 23:14:05 EDT 2008


On May 5, 6:40 pm, castiro... at gmail.com wrote:
> On May 5, 1:26 pm, Aaron Watters <aaron.watt... at gmail.com> wrote:
>
>
>
>
>
> > Hi there.  Maybe a little more context would
> > help us figure out what you want here...
>
> > On May 5, 1:28 pm, castiro... at gmail.com wrote:
>
> > > Is multimap just a syntax-checked dictionary of mutable sequences?
>
> > I think the equivalent of a multimap can be
> > implemented several different ways, depending on
> > what you need:
>
> >   for
> >        1 maps to 2,3
> >        5 maps to 7
> >   - dictionary mapping to lists
> >        { 1:[2,3], 5:[7] } # supports unhashable values
> >   - dictionary mapping to dictionary
> >        { 1:{2:None,3:None}, 4:{7:None} } # faster for certain lookups
> > and dense data
> >   - dictionary with tuple/pairs as keys
> >        { (1,2):None, (1,3):None, (4,7):None } # streamlined for
> > existence testing
>
> It's possible there are four different kinds of multimaps.
>
> objects map to set
> objects map to frozenset
> objects map to sequence
> frozenset maps to object
>
> What does the STL use?  I am interested in a serialization that
> changes certain bits and appends more.  Prior discussion brought me to
> multimap, but that quotient stifled it.
>
> > If you search usenet (google groups) for multimap
> > you will find some nice discussions by Alex Martelli and others.
>
> > > Is def( a ): a[:]= [x] a trick or part of the language?  It looks
> > > pretty sharp in variable-width.
>
> > You lost me here.
>
> I was referring to a couple of threads from the Winter [cit. off'd.]
> that never really gelled.
>
> Modifying parameters is crucial to a number of control flow structures
> (program divisions).  Examples could come handy.

I am questioning if value-succession is a sufficient protocol to side
effects.

Fibonacci numbers are formulaic.  Month names are tabular.  Factorials
are recursive.  Hold there is no use for a factorial generator, i.e.
no factorials in business.  Things the real world generates are
network requests of a station, successive graphics (though so far only
for games*), month names (and other units of time), produce, and
dollar values in the form of prices.

* Information display isn't the top of the market.

Simple matching that's hard to explain in a formal language can yield
scheduling, value, opinion.  It is not clear that art or architecture
have tender/vital value.  I.e., it's possible that the only value of
computers is automation in a system that is already pretty fine at
food, utilities, and walls.

If recursive generators are really useless (erect wall might not be),
there's no jobs in looking in to it.  Which brings me to persistence
of generators juxtaposed to merely persistence of functions.
Sequences could map into a database pretty easily, in a line or less,
if deque/set/dict (i.e. non-sequential) don't modify easily on disk,
what's the function that allocates in a database?

> >>> def a( x ): x[:]= [x[0]+ 1]
> ...
> >>> b= [2]
> >>> a(b)
> >>> b
>
> [3]




More information about the Python-list mailing list