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'

Release files for dsr 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dsr 1.0.4
File Size Uploaded
dsr-1.0.4.tar.gz 2.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dsr 1.0.4
File Interpreter ABI Platform
dsr-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / dsr-1.0.4.tar.gz

Download URL dsr-1.0.4.tar.gz
Size 2.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ab671d6344bf92bb37647e703374a41ed25313a58bb7e7bb462954ee2dd3427a
BLAKE2b-256 checksum
How to use checksums
ed9dd38c208897b36422fe486c314886473fedcbd634086c1b8a0218ed9d9b8d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / dsr-1.0.4-py3-none-any.whl

Download URL dsr-1.0.4-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17a3959ca205e1fe38de535706fa39092f7872957b585e5d4375d93f087fa70e
BLAKE2b-256 checksum
How to use checksums
b959b6a77eeda82395ddce7c0a4cd16a8795c191e14d1bbdbe9c25e525afcb7d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

3 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page