def view(self, buffer_time = <NUM_LIT>, sample_size = <NUM_LIT>, name=None, description=None, start=False):
if name is None:<EOL><INDENT>name = '<STR_LIT>'.join(random.choice('<STR_LIT>') for x in range(<NUM_LIT:16>))<EOL><DEDENT>if self.oport.schema == streamsx.topology.schema.CommonSchema.Python:<EOL><INDENT>if self._json_stream:<EOL><INDENT>view_stream = self._json_stream<EOL><DEDENT>else:<EOL><INDENT>self._json_stream = self.as_json(force_object=False)._layout(hidden=True)<EOL>view_stream = self._json_stream<EOL>if self._placeable:<EOL><INDENT>self._colocate(view_stream, '<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>view_stream = self<EOL><DEDENT>port = view_stream.oport.name<EOL>view_config = {<EOL>'<STR_LIT:name>': name,<EOL>'<STR_LIT:port>': port,<EOL>'<STR_LIT:description>': description,<EOL>'<STR_LIT>': buffer_time,<EOL>'<STR_LIT>': sample_size}<EOL>if start:<EOL><INDENT>view_config['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>view_stream.oport.operator.addViewConfig(view_config)<EOL>_view = View(name)<EOL>self.topology.graph._views.append(_view)<EOL>return _view<EOL>
Defines a view on a stream.

A view is a continually updated sampled buffer of a streams's tuples.
Views allow visibility into a stream from external clients such
as Jupyter Notebooks, the Streams console,
`Microsoft Excel <https://www.ibm.com/support/knowledgecenter/SSCRJU_4.2.0/com.ibm.streams.excel.doc/doc/excel_overview.html>`_ or REST clients.

The view created by this method can be used by external clients
and through the returned :py:class:`~streamsx.topology.topology.View` object after the topology is submitted. For example a Jupyter Notebook can
declare and submit an application with views, and then
use the resultant `View` objects to visualize live data within the streams.

When the stream contains Python objects then they are converted
to JSON.

Args:
    buffer_time: Specifies the buffer size to use measured in seconds.
    sample_size: Specifies the number of tuples to sample per second.
    name(str): Name of the view. Name must be unique within the topology. Defaults to a generated name.
    description: Description of the view.
    start(bool): Start buffering data when the job is submitted.
        If `False` then the view starts buffering data when the first
        remote client accesses it to retrieve data.

Returns:
    streamsx.topology.topology.View: View object which can be used to access the data when the
    topology is submitted.

.. note:: Views are only supported when submitting to distributed
    contexts including Streaming Analytics service.