Skip to content

Commit 8223831

Browse files
committed
ENH: Remove alias to 'object' variable name
Use targeted import with alias to avoid polution (import sys) and cleanup (del sys) paradigm.
1 parent a867b5e commit 8223831

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

Wrapping/Generators/Python/itkExtras.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# ==========================================================================*/
1818

1919
import re
20+
from sys import stderr as system_error_stream
2021

2122
# The following line defines an ascii string used for dynamically refreshing
2223
# the import and progress callbacks on the same terminal line.
@@ -147,19 +148,13 @@ def force_load():
147148
getattr(itk, k)
148149

149150

150-
import sys
151-
152-
153-
def echo(object, f=sys.stderr):
154-
"""Print an object is f
151+
def echo(obj, f=system_error_stream):
152+
"""Print an object to stream
155153
156154
If the object has a method Print(), this method is used.
157-
repr(object) is used otherwise
155+
repr(obj) is used otherwise
158156
"""
159-
print(f, object)
160-
161-
162-
del sys
157+
print(f, obj)
163158

164159

165160
def size(image_or_filter):

0 commit comments

Comments
 (0)