Why are you doing this?  Is it so that event triggers for updates on the value can determine wether the update came from python or from javascript?  Needless to say, javascript is single-threaded, so you don't have race conditions.