No project description provided
Project description
Jsmaps:
Starting with Js maps
- Creating a map:
jsmap = map_({'hi':'hello', 'wave':'hi'})
- Basic showcase:
from jsmaps import m #placeholder for map_ jsmap = m({'hi':'hello', 'wave':'hi', 0:'zero'}) print(jsmap) #{ # [0] [hi: hello] # [1] [wave: hi] # [2] [0: zero] #}print(jsmap[1]) #hi print(jsmap['hi']) #hello print(jsmap.get(0)) #zero print(jsmap.pair(0)) #{'hi':'hello'} print(jsmap.getpair(0)) #{2: 'zero'} 2 is the index in the map and zero is the value jsmap[0] = 'bye' #hi will now be bye jsmap['wave'] = 'hand' #wave will now be hand
Jsmaps Docs:
.get(self, value):
Like jsmap[value]
expect the value
is always treated as a dict key.
.pair(self, value, *, type=dict):
Returns the not specifed pair as a dict or list.
For example:
#map has [1] [hi: hello]
.pair(1) #{'hi':'hello'}
.pair('hi') #{1:'hello'}
.pair(1, type=list) ##['hi','hello']
.getpair(self, value, *, type=dict):
returns the index and value of a key as a dict or list.
#map has [2] [0: zero]
.getpair(0) #{2: 'zero'}
Tuple sets(beta)
Warning! beta. not completed.
Goal:
jsmap[key, slot] = value
jsmap[1, 1] = 'hi' #[1] ['hello':'hi'] is now [1] ['hi':'hi']
jsmap[1, 2] = 'hi' #[1] ['hi':'hello'] is now [1] ['hi':'hi']
jsmap[1, None] = {'hi': 'hi'} #[1] ['hello':'hello'] is now [1] ['hi':'hi']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsmaps-0.1.2.tar.gz
(2.7 kB
view hashes)
Built Distribution
jsmaps-0.1.2-py3-none-any.whl
(2.7 kB
view hashes)