On Mon, Jun 7, 2010 at 1:16 PM, Thomas Jollans wrote:
> On 06/07/2010 07:45 PM, Dan Stromberg wrote:
>
>
> Call me strange, but I regard this as a good place to use a functional
> style - IE, to use reduce, and furthermore I regard this as a good example
> of why reduce is useful for more than j
On 06/07/2010 07:45 PM, Dan Stromberg wrote:
>
> Call me strange, but I regard this as a good place to use a functional
> style - IE, to use reduce, and furthermore I regard this as a good
> example of why reduce is useful for more than just summing numbers:
>
> #!/disc/gx/sdfw/dans/python26/bin/py
Call me strange, but I regard this as a good place to use a functional style
- IE, to use reduce, and furthermore I regard this as a good example of why
reduce is useful for more than just summing numbers:
#!/disc/gx/sdfw/dans/python26/bin/python
import collections
def count_first_letters(dictio
GZ wrote:
Hi,
I am looking for a fast internal vector representation so that
(a1,b2,c1)+(a2,b2,c2)=(a1+a2,b1+b2,c1+c2).
So I have a list
l = ['a'a,'bb','ca','de'...]
I want to count all items that start with an 'a', 'b', and 'c'.
What I can do is:
count_a = sum(int(x[1]=='a') for x in l)
co
On Sat, Jun 5, 2010 at 6:20 PM, GZ wrote:
> Hi,
>
> I am looking for a fast internal vector representation so that
> (a1,b2,c1)+(a2,b2,c2)=(a1+a2,b1+b2,c1+c2).
>
> So I have a list
>
> l = ['a'a,'bb','ca','de'...]
>
> I want to count all items that start with an 'a', 'b', and 'c'.
>
> What I can d