Re: Implementation of an lru_cache() decorator that ignores the first argument

2022-09-30 Thread Heinrich Kruger
per In the _cached function In the expensive function (3, 2, 3) It's not necessarily better than your version though. :D Kind regards, Heinrich Kruger -- https://mail.python.org/mailman/listinfo/python-list

Re: Embedding version in command-line program

2020-10-09 Thread Heinrich Kruger
u can do something like: ``` from . import __version__ def main(): print(f"Version: {__version__}") ``` Bear in mind that this would only work if your package is installed (e.g. in virtual environment). Otherwise the `metadata.version(__name__)` call will fail with a `importlib.met

Re: Funny behavior of IDLE 3.7.0

2019-11-12 Thread Heinrich Kruger
ormal string, where > the {} don't have a special meaning. What the OP was trying to do is valid in python 3.8 (see https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging) but not in older versions. To achieve the same result in py

Re: python requests get from API and post to another API and remote u'

2019-08-21 Thread Heinrich Kruger
For example: resp = requests.get('https://example.com/api/data') data = resp.json() requests.post('https://example.com/api/other_data', json=data) See https://2.python-requests.org/en/stable/user/quickstart/#more-complicated-post-requests for more detail. -- Heinrich Kruger -- https://mail.python.org/mailman/listinfo/python-list