denial 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- denial/__init__.py +2 -0
- denial/inner.py +4 -0
- denial-0.0.1.dist-info/LICENSE +21 -0
- denial-0.0.1.dist-info/METADATA +76 -0
- denial-0.0.1.dist-info/RECORD +7 -0
- denial-0.0.1.dist-info/WHEEL +5 -0
- denial-0.0.1.dist-info/top_level.txt +1 -0
denial/__init__.py
ADDED
denial/inner.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pomponchik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: denial
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Is one None not enough for you? There's more
|
|
5
|
+
Author-email: Evgeniy Blinov <zheni-b@yandex.ru>
|
|
6
|
+
Project-URL: Source, https://github.com/pomponchik/nones
|
|
7
|
+
Project-URL: Tracker, https://github.com/pomponchik/nones/issues
|
|
8
|
+
Keywords: None,sentinel
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
11
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
+
Classifier: Operating System :: POSIX
|
|
13
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: Free Threading
|
|
23
|
+
Classifier: Programming Language :: Python :: Free Threading :: 3 - Stable
|
|
24
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
25
|
+
Classifier: Intended Audience :: Developers
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
27
|
+
Requires-Python: >=3.8
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
|
|
31
|
+
# denial
|
|
32
|
+
|
|
33
|
+
[](https://pepy.tech/project/denial)
|
|
34
|
+
[](https://pepy.tech/project/denial)
|
|
35
|
+
[](https://coveralls.io/github/pomponchik/denial?branch=main)
|
|
36
|
+
[](https://github.com/boyter/scc/)
|
|
37
|
+
[](https://hitsofcode.com/github/pomponchik/denial/view?branch=main)
|
|
38
|
+
[](https://github.com/pomponchik/denial/actions/workflows/tests_and_coverage.yml)
|
|
39
|
+
[](https://pypi.python.org/pypi/denial)
|
|
40
|
+
[](https://badge.fury.io/py/denial)
|
|
41
|
+
[](http://mypy-lang.org/)
|
|
42
|
+
[](https://github.com/astral-sh/ruff)
|
|
43
|
+
[](https://deepwiki.com/pomponchik/denial)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
There is a small but annoying misunderstanding in the design of Python as a language. The language defines the constant `None`, which designates a special object that is used as a "stub" when it is not possible to use the "real" value. But sometimes, when implementing libraries, it is not possible to distinguish `None`, passed by the user as the default value, from `None`, which means that the value is *really undefined*. In some rare cases, this distinction is important.
|
|
47
|
+
|
|
48
|
+
For example, the [dataclasses](https://docs.python.org/3/library/dataclasses.html) library defines a special [MISSING](https://docs.python.org/3/library/dataclasses.html#dataclasses.MISSING) constant for such cases. This is used to separate the cases when the user has not set a default value from the case when he has set `None` as the default value. However, the use of `MISSING` is tied to the use of this library, and sometimes this constant may be needed for completely different purposes.
|
|
49
|
+
|
|
50
|
+
This library defines just such an object: `None` for situations where you need to distinguish `None` as a value from the user, and None as a designation that something is really undefined. This value should not fall "outside", into the user's space, it should remain only inside the libraries implementations.
|
|
51
|
+
|
|
52
|
+
Well, how to use it?
|
|
53
|
+
|
|
54
|
+
Let's start with the installation:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install denial
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This is how this additional version of `None` and its class are imported (can be used for type hints or checks via isinstance):
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from denial import InnerNone, InnerNoneType
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`InnerNone` is used the same way as `None`, with a couple of additional caveats:
|
|
67
|
+
|
|
68
|
+
1. `InnerNone` is not an instance of [`NoneType`](https://docs.python.org/3/library/types.html#types.NoneType), it has its own parent class.
|
|
69
|
+
|
|
70
|
+
2. `InnerNone` cannot be used as your own type hint. What am I talking about? Let's look at the documentation:
|
|
71
|
+
|
|
72
|
+
> When used in a type hint, the expression `None` is considered equivalent to `type(None)`.
|
|
73
|
+
|
|
74
|
+
> *[Official typing documentation](https://typing.python.org/en/latest/spec/special-types.html#none)*
|
|
75
|
+
|
|
76
|
+
In most type checkers, this is implemented using a special "crutch", an exception in the code that cannot be repeated for any other value. Therefore, use `InnerNoneType` as a type hint.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
denial/__init__.py,sha256=LSdeyJCF962IKL6GCdHXSNYCGrbr2RzWU123i_pkRpk,104
|
|
2
|
+
denial/inner.py,sha256=VLSzSzUgUm8sTK9jMFz3s4xUX0OQborCXMs9ATYn98g,59
|
|
3
|
+
denial-0.0.1.dist-info/LICENSE,sha256=DZghylz0nMr7qsnCZwirS05euKMfnORj_5e2zXskGxc,1067
|
|
4
|
+
denial-0.0.1.dist-info/METADATA,sha256=RvtWPbuX3ZXuh7MfJ-yWD-6zb8TcxXVpDk6F1fCLYVY,4946
|
|
5
|
+
denial-0.0.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
6
|
+
denial-0.0.1.dist-info/top_level.txt,sha256=c2Ga_GMvGtOJtfe7IUGtz9TJny9-BT3aLFK6y3srjGA,7
|
|
7
|
+
denial-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
denial
|