Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Renamed func to suffix (my own code confuses me) + minor amendments

  • Loading branch information...
commit 797f323a7d0cef16faa22ba2de8811b3706483a1 1 parent 76bd1fa
@inky authored
Showing with 14 additions and 9 deletions.
  1. +14 −9 see.py
View
23 see.py
@@ -76,6 +76,9 @@ def match(name, fn=fnmatch.fnmatch, pat=pat):
return tuple(filter(match, names))
+class SeeError(Exception): pass
+
+
class _SeeOutput(tuple):
"""Tuple-like object with a pretty string representation."""
@@ -131,20 +134,22 @@ def see(obj=_LOCALS, pattern=None, r=None):
in implements membership tests (e.g. x in obj)
+obj unary positive operator (e.g. +2)
-obj unary negative operator (e.g. -2)
+ ? raised an exception
"""
use_locals = obj is _LOCALS
actions = []
dot = not use_locals and '.' or ''
- name = lambda a, f: ''.join((dot, a, func(f)))
-
- def func(f):
- if f == SeeError: return '??'
- if hasattr(f, '__call__'): return '()'
- return ''
-
- class SeeError:pass
-
+ name = lambda a, f: ''.join((dot, a, suffix(f)))
+
+ def suffix(f):
+ if f == SeeError:
+ return '?'
+ elif hasattr(f, '__call__'):
+ return '()'
+ else:
+ return ''
+
if use_locals:
obj.__dict__ = inspect.currentframe().f_back.f_locals
attrs = dir(obj)
Please sign in to comment.
Something went wrong with that request. Please try again.