Metadata-Version: 2.4
Name: jk_oop
Version: 0.2026.6.25
Summary: A python module to assist with special object oriented aspects.
Keywords: oop
Author-email: Jürgen Knauth <pubsrc@binary-overflow.de>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
License-File: LICENSE.txt
Project-URL: Home, https://github.com/jkpubsrc/python-module-jk-oop
Project-URL: Homepage, https://github.com/jkpubsrc/python-module-jk-oop

jk_oop
================================================================

Introduction
----------------------------------------------------------------

A python module to assist with special object oriented aspects.

Information about this module can be found here:

* [github.org](https://github.com/jkpubsrc/python-module-jk-oop)
* [pypi.python.org](https://pypi.python.org/pypi/jk_oop)

How to use this module
----------------------------------------------------------------

## Import

To import this module use the following statement:

```python
import jk_oop
```

The Classes
----------------------------------------------------------------

## Singleton (for inheritance)

This class implements a singleton with a static instantiation method.

Example:

```python
class MySingleton(jk_oop.Singleton):

	__slots__ = (
		"value",
	)

	@jk_typing.checkFunctionSignature()
	def __initialize(self, someValue:int):
		print("Initializing MySingleton")
		self.value = someValue
	#

#
```

Usage:

```python
# first use with initialization
myInst = MySingleton.getInstance(42)

# same use later
myInst = MySingleton.getInstance()

```

## SingletonMeta (as metaclass)

This class implements a singleton. Initialization is done via constructor.

Example:

```python
class MySingleton(metaclass=jk_oop.SingletonMeta):

	__slots__ = (
		"value",
	)

	@jk_typing.checkFunctionSignature()
	def __init__(self, someValue:int):
		print("Initializing MySingleton")
		self.value = someValue
	#

#
```

Usage:

```python
# first use with initialization
myInst = MySingleton(42)

# same use later
myInst = MySingleton()

```

Author(s)
----------------------------------------------------------------

* Jürgen Knauth: pubsrc@binary-overflow.de

License
----------------------------------------------------------------

This software is provided under the following license:

* Apache Software License 2.0




