old_contents: #!/usr/bin/env python
  
  # Copyright 2017 Stanford University
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  from __future__ import print_function
  
  import legion
  
  @legion.task
  def f(ctx, x, y, z):
      print("inside task f%s" % ((x, y, z),))
      return x+1
  
  @legion.task(privileges = [legion.RW])
  def g(ctx, R):
      print("inside task g%s" % ((R,),))
  
      print(ctx)
      print(R.ctx)
      print(R.handle.tree_id,
            R.handle.index_space.tid,
            R.handle.index_space.id,
            R.handle.field_space.id)
  
      print(R.x)
      print(R.x._as_ndarray())
  
  @legion.task
  def main_task(ctx):
      print("inside main_task()")
  
      x = f(ctx, 1, "asdf", True)
      print("result of f is %s" % x)
  
      R = legion.Region.create(ctx, [4, 4], {'x': legion.double})
      print("region %s" % R)
      # print("field %s" % R.x)
  
      g(ctx, R)
  
new_contents: #!/usr/bin/env python
  
  # Copyright 2017 Stanford University
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  
  from __future__ import print_function
  
  import legion
  
  @legion.task
  def f(ctx, x, y, z):
      print("inside task f%s" % ((x, y, z),))
      return x+1
  
  @legion.task(privileges = [legion.RW])
  def g(ctx, R):
      print("inside task g%s" % ((R,),))
  
      print(R.x)
      print(R.x._get_ndarray())
  
  @legion.task
  def main_task(ctx):
      print("inside main_task()")
  
      x = f(ctx, 1, "asdf", True)
      print("result of f is %s" % x)
  
      R = legion.Region.create(ctx, [4, 4], {'x': legion.double})
      print("region %s" % R)
      # print("field %s" % R.x)
  
      g(ctx, R)
  
subject: Update Python example.