thread_id=8323698496 (step1_unique_id='9484892561164a18af996c2cf7ab6c2f') == (step3_unique_id='9484892561164a18af996c2cf7ab6c2f')
thread_id=8323698496 (step1_unique_id='2f7b73f1301648f3a6cf4a8b2d29f559') == (step3_unique_id='2f7b73f1301648f3a6cf4a8b2d29f559')
thread_id=8323698496 (step1_unique_id='9fc06c8056184fc88c1f3af56e77330d') == (step3_unique_id='9fc06c8056184fc88c1f3af56e77330d')
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo(n): | |
result = 0 | |
for _ in range(n): | |
result += 1 | |
return result | |
def bar(n): | |
foo(n) | |
def baz(n): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fizzbuzz(num): | |
if num % 3 == 0 and num % 5 == 0: | |
return "FizzBuzz" | |
elif num % 3 == 0: | |
return "Fizz" | |
elif num % 5 == 0: | |
return "Buzz" | |
else: | |
return str(num) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am ryu22e on github. | |
* I am ryu22e (https://keybase.io/ryu22e) on keybase. | |
* I have a public key ASBDZmrOn48lxtvj8SIgTvu8KQobwQBHRalV9_EQ2q6zDgo | |
To claim this, I am signing this object: |
【私】: 以下の意見に反論してください。
Pythonはパッケージ管理ツールが未成熟だ。検索するとpip, pipenv, poetryなどの情報を見かけるが、どれを使えばいいか判断が難しい。
【ChatGPT】: あなたの意見は完全に理解できます。パッケージ管理ツールが複数あると、どれを選ぶべきか決めるのは難しいですね。しかしながら、これを「未成熟」と捉えるのは少々見方を変えてみる価値があると思います。
まず、「未成熟」という表現は、これらのツールがまだ開発途上であるか、または必要な機能を欠いていることを意味することが多いです。しかし、Pythonのパッケージ管理ツールについては、それらは非常に成熟しており、さまざまなニーズに対応しています。pipは非常に基本的なツールで、Pythonパッケージのインストールやアンインストールが容易にできます。pipenvとpoetryはより高度な機能を提供し、仮想環境の管理や依存関係の解決も行います。
それぞれのツールが異なるニーズに対応しているということは、Pythonコミュニティが多様な利用シーンに対応しようとしているという証拠です。新しいプロジェクトを始める際に、そのプロジェクトの特性やニーズに最も合うツールを選べるというのは、むしろ強みと捉えられます。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from enum import Enum | |
from typing import assert_never | |
import openai | |
class Mode(Enum): | |
normal = "normal" | |
kansai = "kansai" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Base: | |
def _get_name1(self): | |
return "Base" | |
def __get_name2(self): | |
return "Base" | |
def say_name1(self): | |
print("My name is " + self._get_name1()) |
>>> class Example:
... def __hello(self):
... print("Hello!")
...
>>> example = Example()
>>> dir(example)
['_Example__hello', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']
>>> example._Example__hello() # 先頭アンスコ2つメソッド名は強制的に頭にクラス名が付く
Hello!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import TestCase | |
from .factories import ExampleFactory | |
from .models import Example | |
class ExampleTest(TestCase): | |
def test_example_1(self): | |
# これだとループの回数分INSERT文を発行する(なるべく避けたい書き方) | |
for i in range(3): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from requests import Session | |
from requests.adapters import HTTPAdapter | |
from requests.packages.urllib3.util import Retry | |
def main(): | |
retries = Retry( | |
total=5, | |
backoff_factor=1, |
NewerOlder