title: how does pyspark broadcast variables work
body: <p>I know it utilizes pickle and ship things across nodes and keep in memory and so on. what i'm confused is why the syntax on using it in pyspark work.</p>
  
  <pre><code>def main():
      sc = SparkContext()
      someValue = rand()
      V = sc.broadcast(someValue)
      A = sc.parallelize().map(worker)
  
  def worker(element):
      element *= V.value
  </code></pre>
  
  <p>why the above code doesn't get a "V" not defined complaint? I searched the broadcast-related source code in pyspark but didn't get any clue.</p>