changelog of istr | strings you can count on |

For the full documentation, see www.salabim.org/istr .

version 1.1.28 2026-03-22

version 1.1.27 2026-03-12

version 1.1.26 2026-03-08

It is also possible to test for a palindrome for anything that can be converted to a str:

version 1.1.25 2026-02-17

version 1.1.24 2026-01-27

version 1.1.23 2026-01-24

version 1.1.21 2026-01-21

version 1.1.20 2026-01-20

version 1.1.19 2026-01-17

version 1.1.18 2026-01-16

version 1.1.17 2026-01-11

version 1.1.16 2026-01-10

version 1.1.15 2026-01-06

version 1.1.14 2026-01-05

version 1.1.13 2026-01-04

version 1.1.12 | 2025-12-05

version 1.1.11 | 2025-11-15

version 1.1.10 | 2025-11-14

version 1.1.9 | 2025-11-09

version 1.1.8 | 2025-11-08

Introduced istr.prod(), which is equivalent to math.prod(), but results in an istr. Thus, istr.prod(range(1,5)) is istr(24) And istr.prod((1,2,3), start=4) is also istr(24).

It is also possible to apply prod on an istr: istr(1234).prod() is istr(24) istr("123").prod(start=4) is istr(24)

 

Introduced istr.sumprod(), which is equivalent to math.sumprod(), but applies istr to both iterables. Note that this method is available even in Python < 3.12 . Thus, istr.sumprod("12", (3,4)) is istr(11) In contrast to math.sumprod(), istr.sumprod() supports a strict parameter (True by default) Thus, istr.sumprod("12", (3,4,5), strict=False) is istr(11), whereas istr.sumprod("12", (3,4,5)) raises a ValueError.

 

Python 3.7 is no longer supported. So, from now on Python >= 3.8 is required.

version 1.1.7 | 2025-11-06

A new way to compose an istr from global one-letter variables is introduced: by starting a string with = as an argument to istr, the rest of the argument will be used to compose the istr from the one-letter variables:

Not so much a change in istr, but a remark: To decompose an istr into individual variables, istr.decompose() can be used, But it is arguably easier and safer to unpack the istr, like

, which is functionally equivalent to

version 1.1.6 | 2025-11-05

Refactored istr.is_square(), istr.is_cube(), istr.is_power_of(), istr.is_odd(), istr.is_even(), istr.is_prime() and istr.is_disible_by().

version 1.1.5 | 2025-11-04

Added istr.is_cube() and istr.is_power_of().

Internal change: is_square() now delegates to istr._is_power_off, which is used also for istr.is_cube() and istr.is_power_of().

version 1.1.4 | 2025-10-26

Introduced compose and decompose methods.

With decompose, one-letter global variables can be set from an istr, e.g.

will result in the global variables a=9, b=3 and c=4.

With compose, an istr will be constructed based on the values of one letter global variables, e.g.

will assign istr(470) to s.

version 1.1.3 | 2025-03-09

Readme updated

version 1.1.2 | 2024-11-07

At last, the short form of importing (import istr) works properly!

version 1.1.1 | 2024-11-06

The new way of importing istr didn't work properly. So, importing should be done with from istr import istr (again).

version 1.1.0 | 2024-11-03

With this version is possible to just use import istr instead of from istr import istr

All functionality is maintained.

The only functional difference is that istr cannot be use as a type in subclassing anymore. In order to still be able to subclass, use istr.type instead. So

version 1.0.12 | 2024-08-06

The methods istr.is_even, istr.is_odd, istr.is_square, istr.is_prime and istr.is_divisible_by can now also be used with an ordinary int. E.g.:

version 1.0.11 | 2024-08-05

Introduced istr.is_square and istr.is_prime methods. Examples:

version 1.0.9 | 2024-06-15

Introduced istr.is_divisible_by method. For example:

version 1.0.8 | 2024-06-01

Instead of using istr in the internal methods _int_method and _str_method, the proper class is now used. This makes inheriting from istr more correct.

version 1.0.7 | 2024-05-29

When comparing istrs with <=, <, > and >= the type of the result is now bool, instead of istr, which is more logical.

version 1.0.6 | 2024-05-29

All methods in itertools are now available directly from istr. For example:

This can be handy as these methods don't have to be imported from itertools anymore.

Added tests for these new class methods.

version 1.0.5 | 2024-05-24

Serious bug with caching istr.digits() fixed. Added tests for properly caching istr.digits().

version 1.0.4 | 2024-05-24

Serious bug with the or (|) operator fixed. Added tests for the or (|) operator.

version 1.0.3 | 2024-05-13

The class istr.range is now immutable.

The dunder int methods that were previously all defined separately are now defined with a simple loop that uses partialmethod (this does not change the functionality in any way).

The string methods that were previously all defined separately are now defined with a simple loop that uses partialmethod (this does not change the functionality in any way).

Generating TypeError messages for incompatible types is now direct (via _frepr method) instead of with a tricky force_repr boolean.

The in operator now relies on the contains method inherited from str (in other words it is not overridden anymore).

version 1.0.2 | 2024-05-08

When a string that can't be interpreted as an int is created when istr.repr_mode is 'int', the repr of that file will be ? (was: nan):

will print

version 1.0.1 | 2024-05-07

From now on, the changelog is not anymore part of the istr.py file, but is in a separate changelog.md file.

istr.digits now also supports the letters from A through Z, making it possible to generate digits for bases >10.

Note that the default stop value is 9 when the start is a numeric digit. If start is a letter, the default stop value is Z. So

Technical detail: caching digits is now implemented with a custom cache dict instead of lru_cache to be able to include _base, _int_format and _int_repr_mode in the key.

 

Introduced a new method: all_distinct.

This can be handy for quite a few puzzles.

version 1.0.0 | 2024-05-06

With this version, istrs do not have to be interpretable as an int anymore. Only when arithmetic and friends are to be carried with an istr, that's a requirement.

So now we can say

and get

But

will raise

It is possible to check whether an istr can be interpreted as an int with the is_int method:

will give

This also means that there is no reason for istr('') to be interpreted as 0. So it isn't anymore.

And reversed() now also works with negative numbers, although the result can't be used in calculations.

 

The method / context manager format has been renamed to int_format.

 

The bool method now operates on the string if it can not be interpreted as an int.

That means that bool(istr('')) is False. For any other istr where is_int() is True, bool will be True.

version 0.2.0 | 2024-04-30

Added __iter__ method .

So now,

results in c values that are istrs

 

Added istr.digits method:

Examples

Note that a digit can occur more than once.

version 0.1.2 | 2024-04-26

Added all relevant string methods to return istrs or data structures with istrs.

Added corresponding tests.

version 0.1.0 | 2024-04-22

Changed the way istr.range is implemented.

 

Changed the context manager istr.format() to be used directly without the with statement.

Also, now istr.format() works without any argument and then returns the current format.

 

istr class now uses __slots__.

 

All internal values and methods now start with an underscore.

 

Introduced istr.repr_mode()

 

Introduced istr.base()

 

Extended tests for new functionality

version 0.0.8 |2024-04-18

initial version with changelog