Skip to main content

A package that provides alpha-affixed numeric type

Project description

AlphaAffixedNumericType (aant)

Python data type to support arithmetics on alphanumeric string

Types of arithmetics supported

  • Addition aant + integer * NOTE: integer type must be on the right of addition operator

  • Subtraction aant - [integer|aant]

How to Use

from AlphaAffixedNumericType import AlphaAffixedNumericType

aant = AlphaAffixedNumericType('A123')
print(aant + 1)  # prints 'A124' 
print(aant + 1000)  # prints 'A1123' 

aant += 10
print(aant.get_value()) # prints 'A133'

aant2 = AlphaAffixedNumericType('A123B')
aant3 = AlphaAffixedNumericType('A124B')
print(aant2 - aant3)  # prints -1 

print(aant2 - 200)  # raises 'NumericArithmeticException' - Numeric part of aant2 (123) is less than 200

aant4 = AlphaAffixedNumericType('A0001B')
print(aant4 + 1000)  # prints 'A1001B' 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for AlphaAffixedNumericType, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size AlphaAffixedNumericType-0.1.0-py3-none-any.whl (4.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size AlphaAffixedNumericType-0.1.0.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page