Not clear about the dot notation
TomF
tomf.sessile at gmail.com
Sun Jan 16 15:24:40 EST 2011
On 2011-01-16 11:59:11 -0800, Zeynel said:
> What does vote.vote refer to in this snippet?
>
> def txn():
> quote = Quote.get_by_id(quote_id)
> vote = Vote.get_by_key_name(key_names = user.email(), parent =
> quote)
> if vote is None:
> vote = Vote(key_name = user.email(), parent = quote)
> if vote.vote == newvote:
> return
> quote.votesum = quote.votesum - vote.vote + newvote
> vote.vote = newvote
>
> from here: http://code.google.com/appengine/articles/overheard.html
vote refers to the Vote instance.
vote.vote refers to the instance variable in that instance:
vote: The value of 1 for like, -1 for dislike.
Confusing choice of names, in my opinion.
-Tom
More information about the Python-list
mailing list