Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49660 > unrolled thread

Re: how to calculate reputation

Started byJoshua Landau <joshua.landau.ws@gmail.com>
First post2013-07-02 23:00 +0100
Last post2013-07-02 23:00 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: how to calculate reputation Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-02 23:00 +0100

#49660 — Re: how to calculate reputation

FromJoshua Landau <joshua.landau.ws@gmail.com>
Date2013-07-02 23:00 +0100
SubjectRe: how to calculate reputation
Message-ID<mailman.4129.1372802489.3114.python-list@python.org>
On 2 July 2013 22:43, Surya Kasturi <suryak@ieee.org> wrote:
> Hi all, this seems to be quite stupid question but I am "confused"..
> We set the initial value to 0, +1 for up-vote and -1 for down-vote! nice.
>
> I have a list of bool values True, False (True for up vote, False for
> down-vote).. submitted by users.
>
> [True, False, False, True....]
>
> Now to calculate the total reputation
>
> should I take True = +1, False=0  [or] True = +1, False=-1 ?? for adding
> all.
>
> I am missing something here.. and that's clear.. anyone please help me on
> it?

It depends what you want to do.

I suggest http://www.evanmiller.org/how-not-to-sort-by-average-rating.html.
This aint so simple, but it's the correct way to sort by "approval".
In fact, it's bloody confusing.

To assume that only the "sum" approval counts, I'd not suggest {True:
1, False: 0}. The problem is that a "downvote" then becomes pointless.
So probably go with False as -1.


So you'd want:

sum((1 if vote else -1) for vote in votes)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web