This package contains implementation of the library "ObjectAsString". ObjectAsString is a library which makes coding in Python feel like Java and JavaScript. "+" operator will automatically be string concatenation if non-numeric types are involved.
Project description
ObjectAsString
ObjectAsString a library which makes coding in Python feel like Java and JavaScript. "+" operator will automatically be string concatenation if non-numeric types are involved.
Installation
pip install ObjectAsString
Usage
To use the library install it using the command shown in "Installation" section. Then, read the instructions below regarding how to use operations with StaticTypedList.
Length
'len()' function can be called with a ObjectAsString as the parameter. It gets the length of the object in ObjectAsString if the object is either a list or a string.
Input: len(ObjectAsString([4, 5, 3])) Output: 3
Addition
Adding two objects which are lists will be treated as combining lists. If two numbers are added, they will be treated as addition of their values. Other additions will be considered string concatenation.
Input: ObjectAsString("5xf") + 2 Output: ObjectAsString("5xf2")
Subtraction
Subtraction works between two objects which are numbers.
Input: ObjectAsString(mpf("5.3")) - mpf("2") Output: ObjectAsString(mpf("3.3"))
Multiplication
Multiplying a list and a number will be treated as repeating a list. Meanwhile, multiplying two numbers will be treated as multiplication of their values. Other
Input: ObjectAsString([4, 5, 3]) * 2 Output: [4, 5, 3, 4, 5, 3]
Division
Division works between two objects which are numbers.
Input: ObjectAsString(mpf("5")) / mpf("2") Output: ObjectAsString(mpf("2.5"))
Modulo
Modulo works between two objects which are numbers.
Input: ObjectAsString(mpf("5")) % mpf("2") Output: ObjectAsString(mpf("1"))
Integer Division
Integer Division works between two objects which are numbers.
Input: ObjectAsString(5) // 2 Output: ObjectAsString(2)
Exponents
Exponents work between two objects which are numbers.
Input: ObjectAsString(mpf("5")) ** mpf("2") Output: ObjectAsString(mpf("25"))
Comparisons
When applying comparisons (i.e., either '<', '<=', '>', '>=', '==', or '!='), two objects will be compared.
Input: ObjectAsString("ssd") == "ssd" Output: True
Tests
Tests for this project are available in https://github.com/DigitalCreativeApkDev/ObjectAsString/blob/master/ObjectAsString/ObjectAsString_tests.py.
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
Built Distribution
Hashes for ObjectAsString-1-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02bbb44e7b98addde0b8272b3f6960295d01db65ce934ab975b6a2c4aedbe8a9 |
|
MD5 | fbd2994fd062deef526e3475c49aba50 |
|
BLAKE2b-256 | 152cb55eccdacfdd81806cf7900da99b8fcdd9755c2e11f43a32183450d82a6c |