Skip to content

Commit 27da59a

Browse files
committed
Avoided if statements with __future__
Signed-off-by: Deepanshu <deepanshu2017@gmail.com>
1 parent 2d4c55e commit 27da59a

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

examples/PhaseSpace/phsp_averaging_functor.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
Date : Aug 21, 2017
1212
"""
1313

14+
from __future__ import print_function
1415
import HydraPython as hypy
1516
import sys
1617
import time
@@ -57,15 +58,9 @@ def main():
5758

5859
# Device #
5960

60-
if sys.version_info.major == 2:
61-
print
62-
sys.stdout.write(constants.RED)
63-
print "ERROR: device is not supported with custom functors in current HydraPython version."
64-
sys.stdout.write(constants.RESET)
65-
else:
66-
print()
67-
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.")
68-
print(constants.RESET)
61+
print()
62+
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.")
63+
print(constants.RESET)
6964

7065
# Host #
7166
start = time.time()

examples/PhaseSpace/phsp_evaluating_functor.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Date : Aug 21, 2017
1111
"""
1212

13+
from __future__ import print_function
1314
import HydraPython as hypy
1415
import sys
1516
import time
@@ -56,16 +57,9 @@ def main():
5657

5758
# Device #
5859

59-
if sys.version_info.major == 2:
60-
print
61-
sys.stdout.write(constants.RED)
62-
print "ERROR: device is not supported with custom functors in current HydraPython version."
63-
sys.stdout.write(constants.RESET)
64-
else:
65-
print()
66-
print(sys.version_info.major)
67-
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.")
68-
print(constants.RESET)
60+
print()
61+
print(constants.RED, "ERROR: device is not supported with custom functors in current HydraPython version.")
62+
print(constants.RESET)
6963

7064
# Host #
7165
result = hypy.host_vector_float2(nentries)

0 commit comments

Comments
 (0)