how to calculate reputation

2013-07-02 Thread Surya Kasturi
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?

Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to calculate reputation

2013-07-02 Thread Surya Kasturi
On Tue, Jul 2, 2013 at 11:59 PM, Tobiah  wrote:

> On 07/02/2013 02:43 PM, Surya Kasturi 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?
>>
>> Thanks
>>
>>
>>
>>
> for vote in bool_votes:
>
> reputation += 2 * vote - 1
>
>
> Tobiah
> --
> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list>
>


I think I didnt explain it clearly.. let me make it clear..

1. The database we are using is having BooleanField for it!! so, cant do
anything
2. I am not looking for sorting algorithms .. just simple math :) It sounds
crazy but let me describe my confusion

lets have 3 users with

[null, null, null]
reputation = 0

[T, - - ]
rept = 1

[T T T]
rept = 3

[T T F]
rept = 1 (its jumping from 3 to 1 -->but generally, we observe only
decrease in 1 right?)

[T T F]
rept = 3 (its jumping from 1 to 3)

These jumpings are common? or my logic is going any wrong?
-- 
http://mail.python.org/mailman/listinfo/python-list


Help: pickle module unable to load "rb" mode files in linux

2013-04-02 Thread Surya Kasturi
Hi, hope you can help me on it..

with open(pickle_f, 'r') as fhand:
obj = pickle.load(fhand)


This works on linux but not in windows until  I use "rb" mode while
creating file object. Surprisingly, the "rb" mode is not working on Linux..
raising EOFError.

Why is this happening?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help: pickle module unable to load "rb" mode files in linux

2013-04-07 Thread Surya Kasturi
I am attaching the file which has to be read.. please take a look into it.
The actual source code can be observed at
https://github.com/scipy/SciPyCentral/blob/master/scipy_central/rest_comments/views.py#L235


when we use "rb" mode in windows, its working. but its not working in linux
system (particularly CentOS)



On Tue, Apr 2, 2013 at 8:50 PM, Peter Otten <__pete...@web.de> wrote:

> Surya Kasturi wrote:
>
> > Hi, hope you can help me on it..
> >
> > with open(pickle_f, 'r') as fhand:
> > obj = pickle.load(fhand)
> >
> >
> > This works on linux but not in windows until  I use "rb" mode while
> > creating file object. Surprisingly, the "rb" mode is not working on
> > Linux.. raising EOFError.
> >
> > Why is this happening?
>
> I don't know.
>
> Please give a complete self-contained example that uses "wb" to write the
> file and "rb" to read it, and that fails on Linux. Don't forget to tell us
> the version of Python you used to run that script.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


index.fpickle
Description: Binary data
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: django vs zope vs web2py

2013-04-21 Thread Surya Kasturi
On Sun, Apr 21, 2013 at 11:48 AM, Alok Singh Mahor wrote:

> I am sorry by mistake I sent incomplete mail here is my mail.
>
> Hi everyone,
> few months back I decided to adopt python for my all sort of work
> including web programming. and I have wasted long time deciding which to
> adopt out of django, zope and web2py.
> I am from php and drupal background. which framework would be better for
> me. I am open to learn anything, anything new. but I want to adopt best
> thing full of features and lot of plugins/extensions and easy to use and
> have better documentation and books etc.
>
> please suggest me so without wasting more time I can start learning
> thanks in advance :)
> --
> http://mail.python.org/mailman/listinfo/python-list
>

You see, in my experience, if you are trying to find the best before
starting (to learn), probably might never going to start.
I don't know what's your Python experience but Django is a decent option to
start over! To start Django, the documentation is one of the best way to
start over!!

Since, you are already into web dev using php, drupal etc. Unless you are
very particular in starting with Django... I suggest you to take a look
into other areas of Python.

May be Network programming or systems programming or getting around
algorithms - trying to learn some mind blowing algos.. hack around on
network..

Come back and do Django.. you will see a lot of fresh ideas!!
-- 
http://mail.python.org/mailman/listinfo/python-list