<commit_before>infinity
========

|Build Status| |Version Status| |Downloads|

All-in-one infinity value for Python. Can be compared to any object.


Why?
----

* Python has `float('inf')` and `float('-inf')`. However these simply represent floating point infinity values. I wanted to create a class which can be compared to any comparable object.

* Writing `float('inf')` is clumsy compared to just `inf`

* `pow(1, float('inf'))` returns 1 whereas it should be undefined (see why: http://math.stackexchange.com/questions/319764/1-to-the-power-of-infinity-why-is-it-indeterminate). In infinity this operation returns TypeError.

* http://stackoverflow.com/questions/382603/when-would-you-use-infinity


Installation
------------


Simply grab the package from pypi::


    pip install infinity


Supported python versions:

* Python 2.6
* Python 2.7
* Python 3.3
* PyPy


Object comparison
-----------------

The `Infinity` class supports rich comparison methods:


.. code-block:: python

    from infinity import inf
    import sys

    3 < inf                     # True
    datetime(2000, 2, 2) < inf  # True
    -inf < inf                  # True
    inf == inf                  # True
    -inf == -inf                # True


Arithmetic operators
--------------------


It also supports arithmetic operators:

.. code-block:: python

    inf + inf                   # inf
    -inf - inf                  # -inf

    inf + 3                     # inf
    inf + datetime(2000, 2, 2)  # inf

    5 / inf                     # 0.0
    3 / -inf                    # -0.0

    pow(inf, 0.5)               # inf

The following operations raise `TypeError` exceptions:

.. code-block:: python

    inf - inf
    -inf + inf
    inf / inf
    inf * 0<commit_msg>Fix inline literals in the README<commit_after>infinity
========

|Build Status| |Version Status| |Downloads|

All-in-one infinity value for Python. Can be compared to any object.


Why?
----

* Python has ``float('inf')`` and ``float('-inf')``. However these simply represent floating point infinity values. I wanted to create a class which can be compared to any comparable object.

* Writing ``float('inf')`` is clumsy compared to just ``inf``

* ``pow(1, float('inf'))`` returns 1 whereas it should be undefined (see why: http://math.stackexchange.com/questions/319764/1-to-the-power-of-infinity-why-is-it-indeterminate). In infinity this operation returns ``TypeError``.

* http://stackoverflow.com/questions/382603/when-would-you-use-infinity


Installation
------------


Simply grab the package from pypi::


    pip install infinity


Supported python versions:

* Python 2.6
* Python 2.7
* Python 3.3
* PyPy


Object comparison
-----------------

The ``Infinity`` class supports rich comparison methods:


.. code-block:: python

    from infinity import inf
    import sys

    3 < inf                     # True
    datetime(2000, 2, 2) < inf  # True
    -inf < inf                  # True
    inf == inf                  # True
    -inf == -inf                # True


Arithmetic operators
--------------------


It also supports arithmetic operators:

.. code-block:: python

    inf + inf                   # inf
    -inf - inf                  # -inf

    inf + 3                     # inf
    inf + datetime(2000, 2, 2)  # inf

    5 / inf                     # 0.0
    3 / -inf                    # -0.0

    pow(inf, 0.5)               # inf

The following operations raise ``TypeError`` exceptions:

.. code-block:: python

    inf - inf
    -inf + inf
    inf / inf
    inf * 0
{'fraction_non_alphanumeric': 0.13322091062394603, 'fraction_numerical': 0.02473299606520517, 'mean_word_length': 1.8381180223285487, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1810589', 'n_tokens_mistral': 1119, 'n_tokens_neox': 984, 'n_words': 352}