Skip to main content

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.

Release files for ObjectAsString 1

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

Source distribution (sdist)

Source distribution for ObjectAsString 1
File Size Uploaded
ObjectAsString-1.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ObjectAsString 1
File Interpreter ABI Platform
ObjectAsString-1-py2-none-any.whl Python 2 none any Details

Total release size: 10.0 kB

Release files / ObjectAsString-1.tar.gz

Download URL ObjectAsString-1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3c3cbb8f57983e18eb8fd007660a49703c45a7c5a0799b2e722e457651932c99
BLAKE2b-256 checksum
How to use checksums
f8cde7b54cb34a7ff2eb02a349b248d452c96921600ece533c9e425187304647
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / ObjectAsString-1-py2-none-any.whl

Download URL ObjectAsString-1-py2-none-any.whl
Size 5.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
02bbb44e7b98addde0b8272b3f6960295d01db65ce934ab975b6a2c4aedbe8a9
BLAKE2b-256 checksum
How to use checksums
152cb55eccdacfdd81806cf7900da99b8fcdd9755c2e11f43a32183450d82a6c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1 This release

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