[GitHub] storm pull request #1918: STORM-2339: Python code format cleanup in storm.py
Github user asfgit closed the pull request at: https://github.com/apache/storm/pull/1918 ---
[GitHub] storm pull request #1918: STORM-2339: Python code format cleanup in storm.py
Github user HeartSaVioR commented on a diff in the pull request: https://github.com/apache/storm/pull/1918#discussion_r105096961 --- Diff: bin/storm.py --- @@ -193,21 +205,26 @@ def parse_args(string): args = [re.compile(r"'((?:[^'\\]|\\.)*)'").sub('\\1', x) for x in args] return [re.compile(r'\\(.)').sub('\\1', x) for x in args] -def exec_storm_class(klass, jvmtype="-server", jvmopts=[], extrajars=[], args=[], fork=False, daemon=True, daemonName=""): -global CONFFILE -storm_log_dir = confvalue("storm.log.dir",[CLUSTER_CONF_DIR]) -if(storm_log_dir == None or storm_log_dir == "nil"): + +def exec_storm_class(klass, jvmtype="-server", jvmopts=None, extrajars=None, args=None, fork=False, daemon=True, --- End diff -- Wow... I didn't know its behavior completely even I worked with Python for 2 years! (4 years ago indeed...) Feels like far from its definition... Thanks for sharing. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] storm pull request #1918: STORM-2339: Python code format cleanup in storm.py
Github user tibkiss commented on a diff in the pull request: https://github.com/apache/storm/pull/1918#discussion_r105094892 --- Diff: bin/storm.py --- @@ -193,21 +205,26 @@ def parse_args(string): args = [re.compile(r"'((?:[^'\\]|\\.)*)'").sub('\\1', x) for x in args] return [re.compile(r'\\(.)').sub('\\1', x) for x in args] -def exec_storm_class(klass, jvmtype="-server", jvmopts=[], extrajars=[], args=[], fork=False, daemon=True, daemonName=""): -global CONFFILE -storm_log_dir = confvalue("storm.log.dir",[CLUSTER_CONF_DIR]) -if(storm_log_dir == None or storm_log_dir == "nil"): + +def exec_storm_class(klass, jvmtype="-server", jvmopts=None, extrajars=None, args=None, fork=False, daemon=True, --- End diff -- Glad you asked. Specifying empty list as default gets initialized once, therefore multiple calls to the function will accumulate the appended values to the list. More lengthy description of this 'feature' could be found here: http://effbot.org/zone/default-values.htm --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] storm pull request #1918: STORM-2339: Python code format cleanup in storm.py
Github user HeartSaVioR commented on a diff in the pull request: https://github.com/apache/storm/pull/1918#discussion_r105018450 --- Diff: bin/storm.py --- @@ -193,21 +205,26 @@ def parse_args(string): args = [re.compile(r"'((?:[^'\\]|\\.)*)'").sub('\\1', x) for x in args] return [re.compile(r'\\(.)').sub('\\1', x) for x in args] -def exec_storm_class(klass, jvmtype="-server", jvmopts=[], extrajars=[], args=[], fork=False, daemon=True, daemonName=""): -global CONFFILE -storm_log_dir = confvalue("storm.log.dir",[CLUSTER_CONF_DIR]) -if(storm_log_dir == None or storm_log_dir == "nil"): + +def exec_storm_class(klass, jvmtype="-server", jvmopts=None, extrajars=None, args=None, fork=False, daemon=True, --- End diff -- Just curious: I know it works, but would like to see why you avoid having `[]` as default value. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---