Usage¶
Import see¶
The function named see is all you need.
In the Python interpreter, run:
>>> from see import see
You can use a startup file to ensure that see is always
imported when you start Python.
Inspect an object¶
-
see.see(obj=anything) Show the features and attributes of an object.
This function takes a single argument,
obj, which can be of any type. A summary of the object is printed immediately in the Python interpreter. For example:>>> see([]) [] in + += * *= < <= == != > >= dir() hash() help() iter() len() repr() reversed() str() .append() .clear() .copy() .count() .extend() .index() .insert() .pop() .remove() .reverse() .sort()
If this function is run without arguments, it will instead list the objects that are available in the current scope.
>>> see() os random see() sys
The return value is an instance of
SeeResult.
Examine the results¶
-
class
see.output.SeeResult(tokens) The output of the
see()function.Acts like a tuple of strings, so you can iterate over the output:
>>> first = see()[0] >>> for string in see([]): ... print(string)
-
filter(pattern) Filter the results using a pattern.
This accepts a shell-style wildcard pattern (as used by the fnmatch module):
>>> see([]).filter('*op*') .copy() .pop()
It also accepts a regular expression. This may be a compiled regular expression (from the re module) or a string that starts with a
/(forward slash) character:>>> see([]).filter('/[aeiou]{2}/') .clear() .count()
-
Symbols¶
Some special symbols are used in the output from see to show the features
of the object.
()- Object is a function or may be called like a function.Example:
obj() .*- Object implements
__getattr__, so it may allow you to access attributes that are not defined.Example:obj.anything. []- Object supports the
[]syntax.Example:obj[index] with- Object can be used in a
withstatement.Example:with obj as target in- Object supports the
inoperator.Example:for item in obj + - * / // % **- Object supports these arithmetic operators.Example:
obj + 1 << >> & ^ |- Object supports these bitwise operators.Example:
obj << 1 +obj -obj- Object supports the unary arithmetic operators
+(positive) and-(negative) respectively.Example:+1,-1 ~- Object supports the unary bitwise operator
~(invert).Example:~1 < <= == != > >=- Object supports these comparison operators.Example:
obj << 1 @- Object supports the
@operator (matrix multiplication), introduced in Python 3.5.Example:obj @ matrix