Skip to main content

A tool for traversing multi-dimensional lists.

Project description

listwalker

A tool for traversing multi-dimensional lists in Python.

Installation

pip install --upgrade listwalker

Examples

from listwalker import ListWalker2D

walker2D = ListWalker2D[int]([
	[1, 2, 3, 4, 5],
	[6, 7, 8, 9, 10],
	[11, 12, 13, 14, 15],
	[16, 17, 18, 19, 20],
	[21, 22, 23, 24, 25],
	[26, 27, 28, 29, 30]
])  # The cursor is at 1

walker2D.walk_down()  # The cursor is at 6
walker2D.walk_down()  # The cursor is at 11
walker2D.walk_down()  # The cursor is at 16
walker2D.walk_right()  # The cursor is at 17

print(walker2D.cursor_element.value)  # -> 17
print(walker2D.get_neighbors())
# {
# 	'up': ListWalkerElement(12),
# 	'right': ListWalkerElement(18),
# 	'down': ListWalkerElement(22),
# 	'left': ListWalkerElement(16)
# }

walker2D.print()
# +---+----+--------+----+----+----+
# |   | 0  |   1    | 2  | 3  | 4  |
# +---+----+--------+----+----+----+
# | 0 | 1  |   2    | 3  | 4  | 5  |
# | 1 | 6  |   7    | 8  | 9  | 10 |
# | 2 | 11 |   12   | 13 | 14 | 15 |
# | 3 | 16 | > 17 < | 18 | 19 | 20 |
# | 4 | 21 |   22   | 23 | 24 | 25 |
# | 5 | 26 |   27   | 28 | 29 | 30 |
# +---+----+--------+----+----+----+

Project details


Download files

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

Source Distribution

listwalker-1.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

listwalker-1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file listwalker-1.1.tar.gz.

File metadata

  • Download URL: listwalker-1.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for listwalker-1.1.tar.gz
Algorithm Hash digest
SHA256 c1ac185bcdc9f16b06387dffcab97dafcfa600193774077aa67a6dee86597437
MD5 b3ca97b4cc33ce0264f13c0239c60de3
BLAKE2b-256 bde81551d6244afb62137ac7bb55a8412b8908d4c15adf364b7be8f39cbe7a00

See more details on using hashes here.

File details

Details for the file listwalker-1.1-py3-none-any.whl.

File metadata

  • Download URL: listwalker-1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.5

File hashes

Hashes for listwalker-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7958fbbf4247967580144670a4a2be7a8ad73b8144acacd5b8caa38a677e5c93
MD5 5cf67699ea746e2111340232a0d7e657
BLAKE2b-256 b4afb37ff5ecc57e3d3e0cbb46431b7e155e2b64e5301586ba321c56d7e81818

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page