You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/01/14 15:59:45 UTC

[GitHub] upgle commented on issue #4215: only nodejs runtime can reuse global scope variable

upgle commented on issue #4215: only nodejs runtime can reuse global scope variable
URL: https://github.com/apache/incubator-openwhisk/issues/4215#issuecomment-454056800
 
 
   oh, I forgot checking that global variable is set. python runtime supports global variable as you said.
   
   ```python
   if 'g' not in globals(): # should be checked that variable is set in globals
       g = 0
   def main(args):
       try:
           global g
           g = g + 1
           return {"count": g}
       except Exception as e:
           # please handle exception here
           # you can return or hide an error message
           return {"error": str(e)}
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services