You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Even if there exists modules that do this (see other answer), I tried to write one simple, self-contained version. Here is a class KeyValueStore (key and value are strings) that works like this: Demo from sqlitekeyvaluestore import KeyValueStore kv = KeyValueStore('test.db') # uses SQLite print(len(kv)) # 0 item kv['hello1'] = 'you1' kv['hello2'] = 'you2' kv['hello3'] = 'you3' print(kv['hello1'])
What is HPy?¶ HPy provides a new API for extending Python in C. In other words, you use #include <hpy.h> instead of #include <Python.h>. What are the advantages of HPy?¶ Zero overhead on CPython: extensions written in HPy run at the same speed as "normal" extensions. Much faster on alternative implementations such as PyPy, GraalPy. Universal binaries: extensions built for the HPy Universal ABI can
This article was discussed on Hacker News (later), on reddit (also), featured in BSD Now 294. Also check out this Endlessh analysis. I’m a big fan of tarpits: a network service that intentionally inserts delays in its protocol, slowing down clients by forcing them to wait. This arrests the speed at which a bad actor can attack or probe the host system, and it ties up some of the attacker’s resourc
... in which we look at one or two ways to make life easier when working with Python regular expressions. tl;dr: You can compose verbose regular expressions using f-strings. Here's a real-world example – instead of this: 1pattern = r"((?:\(\s*)?[A-Z]*H\d+[a-z]*(?:\s*\+\s*[A-Z]*H\d+[a-z]*)*(?:\s*[\):+])?)(.*?)(?=(?:\(\s*)?[A-Z]*H\d+[a-z]*(?:\s*\+\s*[A-Z]*H\d+[a-z]*)*(?:\s*[\):+])?(?![^\w\s])|$)"
はじめに 本書は,筆者が長年書き溜めた様々な実務的な最適化問題についてまとめたものである. 本書は,Jupyter Laboで記述されたものを自動的に変換したものであり,以下のサポートページで公開している. コードも一部公開しているが,ソースコードを保管した Github 自体はプライベートである. 本を購入した人は,サポートページで公開していないプログラムを 圧縮ファイル でダウンロードすることができる. ダウンロードしたファイルの解凍パスワードは<本に記述>である. 作者のページ My HP 本書のサポートページ Support Page 出版社のページ Pythonによる実務で役立つ最適化問題100+ (1) ―グラフ理論と組合せ最適化への招待― Pythonによる実務で役立つ最適化問題100+ (2) ―割当・施設配置・在庫最適化・巡回セールスマン― Pythonによる実務で役立つ
KLab Engineer Advent Calendar 2021 の 6 日目 python -m オプション。 これはライブラリを直接実行するためのオプションです。これでもって標準ライブラリを実行したときこれらがどのように動作するのかを紹介します。便利なもの、どのような動きをするのか想像できないものなど、さまざまで確認していて楽しかったです。 Python 3.10 で確認しています。なお、これらの動作は公式ドキュメントに記載がないもの、単体テスト用途と思われるものが混じっています。それらについて将来のバージョンで同じ動作をし続けるかどうかの保証はありません。 this The Zen of Python を表示するイースターエッグです。インタラクティブシェルに import this と打ち込むことで読むことができる、と紹介されることが多いライブラリですが、 python -m t
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く