Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A module that allows you to create views of your sequences or its slices

Project description

dataview is a module that allows you to create views of your sequences or its slices

Install

pip install dataview

To upgrade a previous installation, use:

pip install dataview

Usage && Examples

>>> from dataview import DataView
>>> # You have some data, it can be any sequence (str, list, bytes, tuple, etc..)
>>> source_data = list(range(5))
>>> # DataView is just a pointer to your source_data and start/stop/step
>>> DataView(source_data)
[0, 1, 2, 3, 4]
>>> DataView(source_data, 3)
[0, 1, 2]
>>> DataView(source_data, 1, 5)
[1, 2, 3, 4]
>>> DataView(source_data, None, None, -1)
[4, 3, 2, 1, 0]
>>> # You can use slices (completely the same way as list slices)
>>> DataView(source_data)[::-1]
[4, 3, 2, 1, 0]
>>> # Slice return a new DataView object, that points to the previous DataView
>>> DataView(source_data)[::-1][2:4]
[2, 1]
>>> # You can change start/stop/step anytime
>>> view = DataView(source_data, 0, 1)
>>> view.start = 1
>>> view.stop = 2
>>> view
[1]
>>> # View always points to actual data
>>> source_data[1] = 2
>>> view
[2]
>>> # You can change a view source data
>>> view.data = list(range(5))
>>> view
[1]

Project details


Release history Release notifications

This version
History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

v1.0.2

History Node

v1.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
dataview-1.0.5.zip (6.0 kB) Copy SHA256 hash SHA256 Source None Apr 5, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page