grscheller.untyped
Untyped modules
Useful modules I found difficult to implement in a strictly typed manner. Not intended to be used with strictly typed code.
module grscheller.untyped.nothing
class Nothing()
Class representing a non-existent value.
- Nothing() is a singleton
- Nothing() instances should be compared with the
isoperator, not== - my[py] becomes problematic when this module is used in a strict typing context
- implementing this module with strict typing is vastly more complicated
- in client code my[py] keeps warning me about what I am doing
- lots of type annotations needed, feels like early Java
instance variable: nothing
- nothing: Nothing = Nothing() is a singleton
1# Copyright 2024 Geoffrey R. Scheller 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15""" 16## Untyped modules 17 18Useful modules I found difficult to implement in a strictly typed manner. Not 19intended to be used with strictly typed code. 20 21### module `grscheller.untyped.nothing` 22 23#### class `Nothing()` 24 25Class representing a non-existent value. 26 27* Nothing() is a singleton 28* Nothing() instances should be compared with the `is` operator, not `==` 29* my[py] becomes problematic when this module is used in a strict typing context 30 * implementing this module with strict typing is vastly more complicated 31 * in client code my[py] keeps warning me about what I am doing 32 * lots of type annotations needed, feels like early Java 33 34#### instance variable: `nothing` 35 36* nothing: Nothing = Nothing() is a singleton 37 38--- 39 40""" 41__version__ = "0.1.1" 42__author__ = "Geoffrey R. Scheller" 43__copyright__ = "Copyright (c) 2024 Geoffrey R. Scheller" 44__license__ = "Apache License 2.0"