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 hidden or 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
| """HttpResponseを使う場合""" | |
| import csv | |
| from django.contrib import admin | |
| from django.http.response import HttpResponse | |
| from .models import Book | |
| def export_as_csv(modeladmin, request, queryset): |
This file contains hidden or 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 PBKDF2PasswordHasher(BasePasswordHasher): | |
| """ | |
| Secure password hashing using the PBKDF2 algorithm (recommended) | |
| Configured to use PBKDF2 + HMAC + SHA256. | |
| The result is a 64 byte binary string. Iterations may be changed | |
| safely but you must rename the algorithm if you change SHA256. | |
| """ | |
| algorithm = "pbkdf2_sha256" | |
| iterations = 36000 |
This file contains hidden or 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 hidden or 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 hidden or 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
| # -*- coding: utf-8 -*- | |
| from django.test import TestCase | |
| class AccountsTest(TestCase): | |
| def test_login_ok(self): | |
| # 最後にスラッシュを入れるのを忘れちゃダメ、ゼッタイ! /accounts/login/にしないと、HTTPステータスコード301が返ってくる。 | |
| r = self.client.get( | |
| '/accounts/login' | |
| ) |
This file contains hidden or 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 hidden or 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" |
>>> 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!NewerOlder