Created temporary directory: /tmp/pip-ephem-wheel-cache-rhnw1dt7 Created temporary directory: /tmp/pip-req-tracker-i9e_7s2z Created requirements tracker '/tmp/pip-req-tracker-i9e_7s2z' Created temporary directory: /tmp/pip-wheel-t2vsm7st Collecting gf3==0.2.4 1 location(s) to search for versions of gf3: * https://pypi.org/simple/gf3/ Getting page https://pypi.org/simple/gf3/ Analyzing links from page https://pypi.org/simple/gf3/ Found link https://files.pythonhosted.org/packages/b4/5d/9b331efb9f8c069031d15e937c9defb40ae4aee983d27e84257e14db49fa/gf3-0.2.1.tar.gz#sha256=983d43c3214268b99a199aa265e57ad7fc8b73d62f54b037cae6f2d814eaa83a (from https://pypi.org/simple/gf3/), version: 0.2.1 Found link https://files.pythonhosted.org/packages/41/66/e70d94e09b7a657d886799aec4083a15904d3d3265267b499f566c4f62c3/gf3-0.2.2.tar.gz#sha256=a8108c2ea33b39f8dc4354d8bef42a035da99ed271a442ac7a650035ae4aa013 (from https://pypi.org/simple/gf3/), version: 0.2.2 Found link https://files.pythonhosted.org/packages/e7/30/8392561c8498531a8e6d33e585f736432b3ffde5301e7999708af011326f/gf3-0.2.3.tar.gz#sha256=a31c64aee81d22a48893fff69f67381fd751fed2fffd6c0f6b3395d610909865 (from https://pypi.org/simple/gf3/), version: 0.2.3 Found link https://files.pythonhosted.org/packages/13/e9/6cbd72d6fd8fa6e4ba0f74608c6cd160cc92d47ad56ea1eb36c173226196/gf3-0.2.4.tar.gz#sha256=08ee61cd016eb4bc5fe606ea95add2b5601ae12e0aa6ee6b28be706057f5b500 (from https://pypi.org/simple/gf3/), version: 0.2.4 Using version 0.2.4 (newest of versions: 0.2.4) Created temporary directory: /tmp/pip-unpack-eme7dhtq Downloading https://files.pythonhosted.org/packages/13/e9/6cbd72d6fd8fa6e4ba0f74608c6cd160cc92d47ad56ea1eb36c173226196/gf3-0.2.4.tar.gz Downloading from URL https://files.pythonhosted.org/packages/13/e9/6cbd72d6fd8fa6e4ba0f74608c6cd160cc92d47ad56ea1eb36c173226196/gf3-0.2.4.tar.gz#sha256=08ee61cd016eb4bc5fe606ea95add2b5601ae12e0aa6ee6b28be706057f5b500 (from https://pypi.org/simple/gf3/) Added gf3==0.2.4 from https://files.pythonhosted.org/packages/13/e9/6cbd72d6fd8fa6e4ba0f74608c6cd160cc92d47ad56ea1eb36c173226196/gf3-0.2.4.tar.gz#sha256=08ee61cd016eb4bc5fe606ea95add2b5601ae12e0aa6ee6b28be706057f5b500 to build tracker '/tmp/pip-req-tracker-i9e_7s2z' Running setup.py (path:/tmp/pip-wheel-t2vsm7st/gf3/setup.py) egg_info for package gf3 Running command python setup.py egg_info 001 ============================================= 002 GF3: Lisp-Like Generic Functions For Python 3 003 ============================================= 004 005 Overview 006 ======== 007 008 `gf` lets you write generic functions 009 `generic functions `_ 010 with multi-methods, that dispatch on all their arguments. 011 012 Simple Example 013 -------------- 014 015 >>> from gf import generic, method 016 >>> add = generic() 017 >>> type(add) 018 019 020 Lets define `add` for two integers: 021 022 >>> @method() 023 ... def add(n0: int, n1: int): 024 ... return n0 + n1 025 026 Lets test it: 027 028 >>> add(1, 2) 029 3 030 031 Calling `add` with instances of other types fails: 032 033 >>> add("Hello ", "World") 034 Traceback (most recent call last): 035 ... 036 NotImplementedError: Generic '__main__.add' has no implementation for type(s): __builtin__.str, __builtin__.str 037 038 Of course `add` can also by defined for two strings: 039 040 >>> @method() 041 ... def add(s0: str, s1: str): 042 ... return s0 + s1 043 044 Now our hello world example works: 045 046 >>> add("Hello ", "World") 047 'Hello World' 048 049 `add` can also be defined for a string and an integer: 050 051 >>> @method() 052 ... def add(s: str, n: int): 053 ... return s + str(n) 054 055 Thus we can add a string and a number: 056 057 >>> add("You ", 2) 058 'You 2' 059 060 Python's Special Methods 061 ------------------------ 062 063 `gf.Object` implements (nearly) all of the `special instance 064 methods of a python object`_ as a generic function. 065 The package includes a rational number implementation that makes 066 heavy use of this feature: 067 068 .. code:: python 069 070 @method() 071 def __add__(a: object, b: Rational): 072 """Add an object and a rational number. 073 074 `a` is converted to a `Rational` and then both are added.""" 075 return Rational(a) + b 076 077 @method(Rational, object) 078 def __add__(a: Rational, b: object): 079 """Add a rational number and an object. 080 081 `b` is converted to a `Rational` and then both are added.""" 082 return a + Rational(b) 083 084 `gf.Object` also has a more Smalltalk means of overwriting 085 `object.__str__` and `object.__repr__` using a file like object. 086 Again the rational example is instructive about its usage. 087 088 .. code:: python 089 090 @method() 091 def __out__(rational: Rational, writer: Writer): 092 """Write a nice representation of the rational. 093 094 Denominators that equal 1 are not printed.""" 095 writer("%d", rational.numerator) 096 if rational.denominator != 1: 097 writer(" / %d", rational.denominator) 098 099 @method() 100 def __spy__(rational: Rational, writer: Writer): 101 """Write a debug representation of the rational.""" 102 writer("%s(", rational.__class__.__name__) 103 if rational.numerator != 0: 104 writer("%r", rational.numerator) 105 if rational.denominator != 1: 106 writer(", %r", rational.denominator) 107 writer(")") 108 109 .. _special instance methods of a python object: 110 http://docs.python.org/2/reference/datamodel.html#special-method-names 111 112 113 Installation 114 ------------ 115 116 As usual `gf3` can be installed with `pip`, like this: 117 118 pip install gf3 119 120 Documentation 121 ------------- 122 123 The whole documentation is available at in the following formats 124 125 HTML 126 http://gf3.klix.ch (Also servers as `gf`'s homepage) 127 128 PDF 129 http://gf3.klix.ch/gf3.pdf 130 131 Changes 132 ------- 133 134 A short sketch of the changes done in each release. 135 136 Release 0.2.4 137 ~~~~~~~~~~~~~ 138 139 The following was changed in Release 0.2.4: 140 141 * The `push`-method accepts an identation string 142 for identing writers. 143 * The methods `push` and `pop` now accept 144 arbitrary arguments in the general case. 145 * Successfully tested the whole framework with Python 3.5. 146 147 148 Release 0.2.3 149 ~~~~~~~~~~~~~ 150 151 The following was changed in Release 0.2.3: 152 153 * Fixed the long description. 154 * Wrote some documentation about changing the implementation 155 class of a generic function. 156 157 158 Release 0.2.2 159 ~~~~~~~~~~~~~ 160 161 The following was changed in Release 0.2.2: 162 163 * Write more documentation. 164 Especially documented the `merge` and the `isgeneric` 165 functions. 166 * Consistency between the long text and on PyPi and the documentation. 167 168 169 Release 0.2.1 170 ~~~~~~~~~~~~~ 171 172 Needed to bump the version information, because the homepage 173 in the package-information was wrong [#]_ and a new upload was needed. 174 175 176 Release 0.2.0 177 ~~~~~~~~~~~~~ 178 179 The following was changed in Release 0.2.0: 180 181 * Ported the whole module to Python 3.6 and Python 3.7. 182 * Exclusively uses `parameter annotations`_ to specify the types to dispatch on. 183 * Added standard conforming default implementations for methods 184 like `__add__`. All these methods now raise a proper 185 `TypeError` instead of raising a `NotImplementedError`. 186 * Added some means to write generic functions that dispatch types only. 187 This is the generic function equivalent of a class-method. 188 * Added some means to dispatch on single objects. 189 This is the equivalent adding methods to class-instances [#]_. 190 * The package name for PyPi is now ``gf3``. 191 192 .. _parameter annotations: https://docs.python.org/3/reference/compound_stmts.html#grammar-token-parameter 193 194 195 Release 0.1.4 196 ~~~~~~~~~~~~~ 197 198 The following was fixed in Release 0.1.4: 199 200 * Fixed an issue with variadic methods. Sometimes definitions 201 of variadic methods added after the method was already called 202 where not added. 203 * Specified and implemented a precedence rule for overlapping 204 variadic methods of generic functions. 205 * Improved generated documentation for variadic methods. 206 * Fixed the markup of some notes in the documentation. 207 208 209 Release 0.1.3 210 ~~~~~~~~~~~~~ 211 212 The following was changed in Release 0.1.3: 213 214 * Added variadic methods, e.g. multi-methods with a 215 variable number of arguments. 216 * Improved the long description text a bit 217 and fixed bug in its markup. 218 * Fixed invalid references in the long description. 219 220 221 Release 0.1.2 222 ~~~~~~~~~~~~~ 223 224 The following was changed in Release 0.1.2: 225 226 * Added a generic functions for `gf.Object.__call__`. 227 * Added a `gf.go.FinalizingMixin`. 228 * `gf.generic` now also accepts a type. 229 * Improved the exception information for ambiguous calls. 230 * Fixed some documentation glitches. 231 232 233 Release 0.1.1 234 ~~~~~~~~~~~~~ 235 236 This was the initial release. 237 238 .. [#] Silly me discovered about the shutdown of pythonhosted.org 239 after version 0.2.0 was uploaded. 240 .. [#] Of course this is not possible with standard python classes 241 and their instances. 242 243 Acknowledgements 244 ================ 245 246 Guido van Rossum created the core of this package. I just renamed some things 247 and added some^H^H^H^H oodles of convenience stuff. Thank you Guido! 248 249 250 Copyright 251 ========= 252 253 © 2006-2013 Python Software Foundation. 254 © 2013-2018 Gerald Klix. 255 running egg_info creating pip-egg-info/gf3.egg-info writing pip-egg-info/gf3.egg-info/PKG-INFO writing dependency_links to pip-egg-info/gf3.egg-info/dependency_links.txt writing top-level names to pip-egg-info/gf3.egg-info/top_level.txt writing manifest file 'pip-egg-info/gf3.egg-info/SOURCES.txt' reading manifest file 'pip-egg-info/gf3.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'pip-egg-info/gf3.egg-info/SOURCES.txt' Source in /tmp/pip-wheel-t2vsm7st/gf3 has version 0.2.4, which satisfies requirement gf3==0.2.4 from https://files.pythonhosted.org/packages/13/e9/6cbd72d6fd8fa6e4ba0f74608c6cd160cc92d47ad56ea1eb36c173226196/gf3-0.2.4.tar.gz#sha256=08ee61cd016eb4bc5fe606ea95add2b5601ae12e0aa6ee6b28be706057f5b500 Removed gf3==0.2.4 from https://files.pythonhosted.org/packages/13/e9/6cbd72d6fd8fa6e4ba0f74608c6cd160cc92d47ad56ea1eb36c173226196/gf3-0.2.4.tar.gz#sha256=08ee61cd016eb4bc5fe606ea95add2b5601ae12e0aa6ee6b28be706057f5b500 from build tracker '/tmp/pip-req-tracker-i9e_7s2z' Building wheels for collected packages: gf3 Created temporary directory: /tmp/pip-wheel-obr0syrn Running setup.py bdist_wheel for gf3: started Destination directory: /tmp/pip-wheel-obr0syrn Running command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-wheel-t2vsm7st/gf3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-obr0syrn 001 ============================================= 002 GF3: Lisp-Like Generic Functions For Python 3 003 ============================================= 004 005 Overview 006 ======== 007 008 `gf` lets you write generic functions 009 `generic functions `_ 010 with multi-methods, that dispatch on all their arguments. 011 012 Simple Example 013 -------------- 014 015 >>> from gf import generic, method 016 >>> add = generic() 017 >>> type(add) 018 019 020 Lets define `add` for two integers: 021 022 >>> @method() 023 ... def add(n0: int, n1: int): 024 ... return n0 + n1 025 026 Lets test it: 027 028 >>> add(1, 2) 029 3 030 031 Calling `add` with instances of other types fails: 032 033 >>> add("Hello ", "World") 034 Traceback (most recent call last): 035 ... 036 NotImplementedError: Generic '__main__.add' has no implementation for type(s): __builtin__.str, __builtin__.str 037 038 Of course `add` can also by defined for two strings: 039 040 >>> @method() 041 ... def add(s0: str, s1: str): 042 ... return s0 + s1 043 044 Now our hello world example works: 045 046 >>> add("Hello ", "World") 047 'Hello World' 048 049 `add` can also be defined for a string and an integer: 050 051 >>> @method() 052 ... def add(s: str, n: int): 053 ... return s + str(n) 054 055 Thus we can add a string and a number: 056 057 >>> add("You ", 2) 058 'You 2' 059 060 Python's Special Methods 061 ------------------------ 062 063 `gf.Object` implements (nearly) all of the `special instance 064 methods of a python object`_ as a generic function. 065 The package includes a rational number implementation that makes 066 heavy use of this feature: 067 068 .. code:: python 069 070 @method() 071 def __add__(a: object, b: Rational): 072 """Add an object and a rational number. 073 074 `a` is converted to a `Rational` and then both are added.""" 075 return Rational(a) + b 076 077 @method(Rational, object) 078 def __add__(a: Rational, b: object): 079 """Add a rational number and an object. 080 081 `b` is converted to a `Rational` and then both are added.""" 082 return a + Rational(b) 083 084 `gf.Object` also has a more Smalltalk means of overwriting 085 `object.__str__` and `object.__repr__` using a file like object. 086 Again the rational example is instructive about its usage. 087 088 .. code:: python 089 090 @method() 091 def __out__(rational: Rational, writer: Writer): 092 """Write a nice representation of the rational. 093 094 Denominators that equal 1 are not printed.""" 095 writer("%d", rational.numerator) 096 if rational.denominator != 1: 097 writer(" / %d", rational.denominator) 098 099 @method() 100 def __spy__(rational: Rational, writer: Writer): 101 """Write a debug representation of the rational.""" 102 writer("%s(", rational.__class__.__name__) 103 if rational.numerator != 0: 104 writer("%r", rational.numerator) 105 if rational.denominator != 1: 106 writer(", %r", rational.denominator) 107 writer(")") 108 109 .. _special instance methods of a python object: 110 http://docs.python.org/2/reference/datamodel.html#special-method-names 111 112 113 Installation 114 ------------ 115 116 As usual `gf3` can be installed with `pip`, like this: 117 118 pip install gf3 119 120 Documentation 121 ------------- 122 123 The whole documentation is available at in the following formats 124 125 HTML 126 http://gf3.klix.ch (Also servers as `gf`'s homepage) 127 128 PDF 129 http://gf3.klix.ch/gf3.pdf 130 131 Changes 132 ------- 133 134 A short sketch of the changes done in each release. 135 136 Release 0.2.4 137 ~~~~~~~~~~~~~ 138 139 The following was changed in Release 0.2.4: 140 141 * The `push`-method accepts an identation string 142 for identing writers. 143 * The methods `push` and `pop` now accept 144 arbitrary arguments in the general case. 145 * Successfully tested the whole framework with Python 3.5. 146 147 148 Release 0.2.3 149 ~~~~~~~~~~~~~ 150 151 The following was changed in Release 0.2.3: 152 153 * Fixed the long description. 154 * Wrote some documentation about changing the implementation 155 class of a generic function. 156 157 158 Release 0.2.2 159 ~~~~~~~~~~~~~ 160 161 The following was changed in Release 0.2.2: 162 163 * Write more documentation. 164 Especially documented the `merge` and the `isgeneric` 165 functions. 166 * Consistency between the long text and on PyPi and the documentation. 167 168 169 Release 0.2.1 170 ~~~~~~~~~~~~~ 171 172 Needed to bump the version information, because the homepage 173 in the package-information was wrong [#]_ and a new upload was needed. 174 175 176 Release 0.2.0 177 ~~~~~~~~~~~~~ 178 179 The following was changed in Release 0.2.0: 180 181 * Ported the whole module to Python 3.6 and Python 3.7. 182 * Exclusively uses `parameter annotations`_ to specify the types to dispatch on. 183 * Added standard conforming default implementations for methods 184 like `__add__`. All these methods now raise a proper 185 `TypeError` instead of raising a `NotImplementedError`. 186 * Added some means to write generic functions that dispatch types only. 187 This is the generic function equivalent of a class-method. 188 * Added some means to dispatch on single objects. 189 This is the equivalent adding methods to class-instances [#]_. 190 * The package name for PyPi is now ``gf3``. 191 192 .. _parameter annotations: https://docs.python.org/3/reference/compound_stmts.html#grammar-token-parameter 193 194 195 Release 0.1.4 196 ~~~~~~~~~~~~~ 197 198 The following was fixed in Release 0.1.4: 199 200 * Fixed an issue with variadic methods. Sometimes definitions 201 of variadic methods added after the method was already called 202 where not added. 203 * Specified and implemented a precedence rule for overlapping 204 variadic methods of generic functions. 205 * Improved generated documentation for variadic methods. 206 * Fixed the markup of some notes in the documentation. 207 208 209 Release 0.1.3 210 ~~~~~~~~~~~~~ 211 212 The following was changed in Release 0.1.3: 213 214 * Added variadic methods, e.g. multi-methods with a 215 variable number of arguments. 216 * Improved the long description text a bit 217 and fixed bug in its markup. 218 * Fixed invalid references in the long description. 219 220 221 Release 0.1.2 222 ~~~~~~~~~~~~~ 223 224 The following was changed in Release 0.1.2: 225 226 * Added a generic functions for `gf.Object.__call__`. 227 * Added a `gf.go.FinalizingMixin`. 228 * `gf.generic` now also accepts a type. 229 * Improved the exception information for ambiguous calls. 230 * Fixed some documentation glitches. 231 232 233 Release 0.1.1 234 ~~~~~~~~~~~~~ 235 236 This was the initial release. 237 238 .. [#] Silly me discovered about the shutdown of pythonhosted.org 239 after version 0.2.0 was uploaded. 240 .. [#] Of course this is not possible with standard python classes 241 and their instances. 242 243 Acknowledgements 244 ================ 245 246 Guido van Rossum created the core of this package. I just renamed some things 247 and added some^H^H^H^H oodles of convenience stuff. Thank you Guido! 248 249 250 Copyright 251 ========= 252 253 © 2006-2013 Python Software Foundation. 254 © 2013-2018 Gerald Klix. 255 running bdist_wheel running build running build_py creating build creating build/lib creating build/lib/gf copying gf/base.py -> build/lib/gf copying gf/go.py -> build/lib/gf copying gf/__init__.py -> build/lib/gf installing to build/bdist.linux-armv7l/wheel running install running install_lib creating build/bdist.linux-armv7l creating build/bdist.linux-armv7l/wheel creating build/bdist.linux-armv7l/wheel/gf copying build/lib/gf/base.py -> build/bdist.linux-armv7l/wheel/gf copying build/lib/gf/go.py -> build/bdist.linux-armv7l/wheel/gf copying build/lib/gf/__init__.py -> build/bdist.linux-armv7l/wheel/gf running install_egg_info running egg_info writing gf3.egg-info/PKG-INFO writing dependency_links to gf3.egg-info/dependency_links.txt writing top-level names to gf3.egg-info/top_level.txt reading manifest file 'gf3.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'gf3.egg-info/SOURCES.txt' Copying gf3.egg-info to build/bdist.linux-armv7l/wheel/gf3-0.2.4-py3.4.egg-info running install_scripts creating build/bdist.linux-armv7l/wheel/gf3-0.2.4.dist-info/WHEEL creating '/tmp/pip-wheel-obr0syrn/gf3-0.2.4-py3-none-any.whl' and adding 'build/bdist.linux-armv7l/wheel' to it adding 'gf/__init__.py' adding 'gf/base.py' adding 'gf/go.py' adding 'gf3-0.2.4.dist-info/METADATA' adding 'gf3-0.2.4.dist-info/WHEEL' adding 'gf3-0.2.4.dist-info/top_level.txt' adding 'gf3-0.2.4.dist-info/zip-safe' adding 'gf3-0.2.4.dist-info/RECORD' removing build/bdist.linux-armv7l/wheel Running setup.py bdist_wheel for gf3: finished with status 'done' Stored in directory: /tmp/tmp3z4yupfw Successfully built gf3 Cleaning up... Removing source in /tmp/pip-wheel-t2vsm7st/gf3 Removed build tracker '/tmp/pip-req-tracker-i9e_7s2z'