create account

RE: Daily Steem-Python Challenge #19, Win 1 Steem! by juliank

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @bruce-forks/re-steempytutorials-daily-steem-python-challenge-19-win-1-steem-20180201t054041432z

· @juliank ·
Nice work! I will send you the prize money.

Question:

You create a separate dict for each thread:
`results.append({})`

And you also lock this dict for every write:
```
      lock.acquire()
            if operation not in self.stats:
                self.stats[operation] = 1
            else:
                self.stats[operation] += 1
            lock.release()
```

Is this required since the dict is still part of the results list? I do not know, so this is a genuine question.

My solution is a bit different in that regard and also yields faster times, I will be submitting a tutorial soon.
👍  
properties (23)
authorjuliank
permlinkre-bruce-forks-re-steempytutorials-daily-steem-python-challenge-19-win-1-steem-20180202t000838091z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2018-02-02 00:08:39
last_update2018-02-02 00:08:39
depth2
children1
last_payout2018-02-09 00:08:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length598
author_reputation117,823,071,447,502
root_title"Daily Steem-Python Challenge #19, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id34,256,737
net_rshares613,754,140
author_curate_reward""
vote details (1)
@bruce-forks ·
Yeah, I don't think that lock is necessary. I used it because I thought since they are all part of a larger array I should use it to be safe, but I think it would be just as safe without. Nice catch!
properties (22)
authorbruce-forks
permlinkre-juliank-re-bruce-forks-re-steempytutorials-daily-steem-python-challenge-19-win-1-steem-20180203t223425340z
categoryprogramming
json_metadata{"tags":["programming"],"app":"steemit/0.1"}
created2018-02-03 22:34:24
last_update2018-02-03 22:34:24
depth3
children0
last_payout2018-02-10 22:34:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length199
author_reputation534,201,026,995
root_title"Daily Steem-Python Challenge #19, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id34,744,984
net_rshares0