diff options
| author | Giampaolo Rodola' <g.rodola@gmail.com> | 2012-06-09 13:42:21 +0000 |
|---|---|---|
| committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2012-06-09 13:42:21 +0000 |
| commit | 3fda52e9e85453ad8bb7b608b5f1dc9d04cbb7bb (patch) | |
| tree | d66d06a5a1ff5c2ee2db06662b1045493f778a6b /psutil/_compat.py | |
| parent | 0d8c6ee142edffd715eeafba4abe785d2c9ef139 (diff) | |
| download | psutil-3fda52e9e85453ad8bb7b608b5f1dc9d04cbb7bb.tar.gz | |
add 'print_' function as 2/3 compatibility layer
Diffstat (limited to 'psutil/_compat.py')
| -rw-r--r-- | psutil/_compat.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/psutil/_compat.py b/psutil/_compat.py index d7a4faa3..d328a52c 100644 --- a/psutil/_compat.py +++ b/psutil/_compat.py @@ -28,6 +28,7 @@ if PY3: long = int xrange = range exec_ = getattr(__builtin__, "exec") + print_ = getattr(__builtin__, "print") else: int = int long = long @@ -44,6 +45,11 @@ else: locs = globs exec("""exec code in globs, locs""") + def print_(s): + sys.stdout.write(s + '\n') + sys.stdout.flush() + + # removed in 3.0, reintroduced in 3.2 try: callable = callable |
