Skip to main content

Introduction

I opened this project to show datastructures by hacking __repr__ function of Python.

Installation

pip install dsr

Example

from dsr import BinaryTreeNode, TreeNode

print('BinaryTreeNode:')

a = BinaryTreeNode(100)

b = BinaryTreeNode(2)

c = BinaryTreeNode(0, a, b)

d = BinaryTreeNode('a', c, c)

a.right = d

a.left = d



print(d)

print('TreeNode:')

root = TreeNode('tree', [

    TreeNode('types', [TreeNode(str), TreeNode(int)]),

    TreeNode('values', [TreeNode(1), TreeNode(3.1415926), TreeNode(True)]),

    TreeNode('empty'),

    2.718281828,

    'Not TreeNode'

])

print(root)

BinaryTreeNode


                      ('a')                      

                     /     \                     

              (0)                         (0)    

             /   \                       /   \   

    (100)         (2)           (100)         (2)

   /     \                     /     \           

...       ...               ...       ...        

TreeNode


('tree')

 ├── ('types')

 │    ├── (<class 'str'>)

 │    └── (<class 'int'>)

 ├── ('values')

 │    ├── (1)

 │    ├── (3.1415926)

 │    └── (True)

 ├── ('empty')

 ├── 2.718281828

 └── 'Not TreeNode'

Download files

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

Source Distribution

dsr-1.0.4.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dsr-1.0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file dsr-1.0.4.tar.gz.

File metadata

  • Download URL: dsr-1.0.4.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for dsr-1.0.4.tar.gz
Algorithm Hash digest
SHA256 ab671d6344bf92bb37647e703374a41ed25313a58bb7e7bb462954ee2dd3427a
MD5 008a236cf6decbbc6cc7c46a8583118a
BLAKE2b-256 ed9dd38c208897b36422fe486c314886473fedcbd634086c1b8a0218ed9d9b8d

See more details on using hashes here.

File details

Details for the file dsr-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: dsr-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0.post20200518 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

File hashes

Hashes for dsr-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 17a3959ca205e1fe38de535706fa39092f7872957b585e5d4375d93f087fa70e
MD5 b90881d54884c1a75394d8d9949bf081
BLAKE2b-256 b959b6a77eeda82395ddce7c0a4cd16a8795c191e14d1bbdbe9c25e525afcb7d

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

3 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page