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
File details
Details for the file ObjectAsString-1.tar.gz
.
File metadata
- Download URL: ObjectAsString-1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c3cbb8f57983e18eb8fd007660a49703c45a7c5a0799b2e722e457651932c99 |
|
MD5 | d1e0a6d5b885509f5ee7cd5ddd59c655 |
|
BLAKE2b-256 | f8cde7b54cb34a7ff2eb02a349b248d452c96921600ece533c9e425187304647 |
File details
Details for the file ObjectAsString-1-py2-none-any.whl
.
File metadata
- Download URL: ObjectAsString-1-py2-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02bbb44e7b98addde0b8272b3f6960295d01db65ce934ab975b6a2c4aedbe8a9 |
|
MD5 | fbd2994fd062deef526e3475c49aba50 |
|
BLAKE2b-256 | 152cb55eccdacfdd81806cf7900da99b8fcdd9755c2e11f43a32183450d82a6c |