ibid.compat – Python Version Compatibility — Ibid v0.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Ibid v0.1.1 documentation »
- API Reference »

# `ibid.compat` – Python Version Compatibility

This module provides compatibility for older Python versions back to 2.4, allowing the use of some newer features.

The following modules and functions are available, and should be imported from `ibid.compat` rather than elsewhere.

## Modules

`email_utils`

  Standard Python `email.utils`.

  Functions for parsing and formatting e-Mail headers.

`hashlib`

  Standard Python `hashlib`.

  Cryptographic hash functions.

  On Python 2.4 it won’t support the SHA-2 functions: `hashlib.sha224()`, `hashlib.sha384()` and `hashlib.sha512()` – these will all return `'Not Supported'`.

`json`

  Standard Python `json`, using SimpleJSON on older versions.

  JSON serialisation and parsing library.

`ElementTree`
  Standard Python `xml.etree.cElementTree`, using ElementTree on older versions.

## Classes

class `ibid.compat.` `defaultdict`([default_factory[, ...]])

  Standard Python `collections.defaultdict`.

  Returns a dict-like-object where all unset values contain the value returned by default_factory().

## Functions

`ibid.compat.` `all`(iterable)

  Standard Python `all()`.

  Return `True` if every item in iterable is `True`.

`ibid.compat.` `any`(iterable)

  Standard Python `any()`.

  Return `True` if any single item in iterable is `True`.

`ibid.compat.` `strptime`(date_string, format)

  Standard Python `datetime.datetime.strptime()`.

  Return a `datetime` corrosponding to date_string, according to format.

`ibid.compat.` `factorial`(x)

  Standard Python `math.factorial()`.

  Return the factorial of x.

### Navigation

- index
- modules |
- next |
- previous |
- Ibid v0.1.1 documentation »
- API Reference »