list comprehention
Mathijs
q.q at q
Mon Jan 23 12:56:54 EST 2006
Op 20 jan 2006 vond Duncan Booth <duncan.booth at invalid.invalid>:
> Or in other words, define a function to return a dictionary containing
> a count of the number of occurrences of each element in the list (this
> assumes that the list elements are hashable). Then you just add up the
> values in the test list making sure each count is limited to no higher
> than the reference count.
Thanks. Though I don't know much about python (yet), this is more or less
the way I'de do it the language I'm more comfortable with (object pascal),
and I wouldn't label this as a pythonic solution. I could be wrong,
though:)
More information about the Python-list
mailing list