pprog 0.0.3
Extension of Python language.

# pprog: Python Programming Tools

## Install

It can be installed with pip.

```shell
pip install --upgrade pprog
```

It works in both Python 2 and Python 3.

## Extension of `importlib`

- `imputil.reload(obj, update_global=True, update_local=True)` provides advanced module and object reloading capabilities for Python, so that developer can modify code without restarting the interpreter.

This function solves key limitations of Python's built-in reloading functionality by:

- Supporting all import styles: `import X`, `from A import X`, and `from A import B as X`
- Automatically updating references without requiring reassignment
- Offering granular control over namespace updates (global and/or local namespace)
- Compatible to both Python 2.6+ and Python 3.1+

Examples:

```python
# Direct import
from mymodule import myfunction
imputil.reload(myfunction)

# Aliased import
from mymodule import myfunction as myfunction1
imputil.reload(myfunction1)

# Module import
import mymodule
imputil.reload(mymodule)

# Module by name
imputil.reload("mymodule")
```

Example: Automatically updates references without reassignment:

```python
from mymodule import myfunction
imputil.reload(myfunction)  # Modify myfunction in mymodule.py
print(myfunction([3,1,2]))  # Uses new version
```

Example: Function Reload with Aliases

```python
from mymodule import myfunction as myfunction1, myfunction as myfunction2
# ... modify myfunction implementation ...
imputil.reload(myfunction1)  # Updates both myfunction1 and myfunction2
```

Example: Selective Namespace Update

```python
myfunction = None  # Global reference
def f():
    global myfunction
    from mymodule import myfunction
    imputil.reload(myfunction, update_local=False)  # Only update global reference
```

```python
def f():
    from mymodule import myfunction
    # ... modify calculator ...
    imputil.reload(myfunction, update_global=False)  # Update only the local calc reference
```

## Extension of `operator`

- `pprog.argchecker(*keys, *, default)` instantiates a callable object that checks whether position arguments and/or keyword arguments are all present, with optional default value for missing arguments.
- `pprog.arggetter(*keys, *, default)` instantiates a callable object that fetches position arguments and/or keyword arguments, with optional default value for missing arguments.
- `pprog.attrchecker(*attrs, *, default)` instantiates a callable object that checks whether the given attribute(s) are all present in its operand, with optional default value for missing attributes.
- `pprog.attrgetter(*attrs, *, default)` instantiates a callable object that fetches the given attribute(s) from its operand, with optional default value for missing attributes.
- `pprog.constantcreator(value, /, *, copy=False)` instantiates a callable object that returns the same constant when it is called.
- `pprog.itemchecker(*items, *, default)` instantiates a callable object that checks whether the given item(s) are all present in its operand, with muti-level keys and optional default value for missing items.
- `pprog.itemgetter(*items, *, default)` instantiates a callable object that fetches the given item(s) from its operand, with muti-level keys and optional default value for missing items.
- `pprog.methodcaller(name, *args, **kwargs)` instantiates a callable object that calls a method with the given name and arguments, supporting `pandas` accessor.

Examples:

```python
>>> from pprog import arggetter
>>> getter = arggetter(0)  # get the first positional argument
>>> getter("value", "other_input", key="other_keyword_input")
'value'

>>> from pprog import attrgetter
>>> getter = attrgetter("upper")
>>> getter("test")
'TEST'

>>> from pprog import constantcreator
>>> creator = constantcreator("value")
>>> creator()
'value'
```