[Merge] lp:~kai-mast/friends/fix-retweets into lp:friends
Robert Bruce Park
robert.park at canonical.com
Fri Dec 6 20:03:06 UTC 2013
Review: Needs Fixing
So this mostly looks good, but there's a bad idiom you used here that you also did in your previous MP:
58 + if "retweeted_status" in tweet:
59 + shared_status = tweet.get('retweeted_status')
There's just no need for this kind of "look before you leap" logic in python. At worst, it's a race condition, and at best it's inefficient.
What you really want to do is something more like this:
message = tweet.get('retweeted_status', {}).get('text', '') or tweet.get('text', '')
If you do that, then you also reduce the number of calls to _resolve_tco() to 1, meaning you can inline it (meaning it doesn't have to be it's own method anymore).
Also you have "entities = tweet.get('entities', {})" in two different places, needlessly redundant.
--
https://code.launchpad.net/~kai-mast/friends/fix-retweets/+merge/198019
Your team Super Friends is subscribed to branch lp:friends.
More information about the Ubuntu-reviews
mailing list