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 ClassMethod(object): | |
| "Emulate PyClassMethod_Type() in Objects/funcobject.c" | |
| def __init__(self, f): | |
| self.f = f | |
| def __get__(self, obj, klass=None): | |
| if klass is None: | |
| klass = type(obj) | |
| def newfunc(*args): |
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 Line(object): | |
| def __init__(self, a, b): | |
| self.a = a | |
| self.b = b | |
| def __eq__(self, other): | |
| return all(( | |
| self.a == other.a, | |
| self.b == other.b | |
| )) |
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 Container: | |
| def __init__(self, list_): | |
| self._list = list_ | |
| def __len__(self): | |
| return len(self._list) | |
| def __getitem__(self, index): |
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 ClassMethod(object): | |
| "Emulate PyClassMethod_Type() in Objects/funcobject.c" | |
| def __init__(self, f): | |
| self.f = f | |
| def __get__(self, obj, klass=None): | |
| ... # ここを実装してください。 | |
| def __call__(self, *args, **kwargs): |
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
| set mouse=a | |
| set clipboard+=unnamedplus | |
| set runtimepath+=/Users/ユーザ名/.cache/dein/repos/github.com/Shougo/dein.vim | |
| if dein#load_state('/Users/ユーザ名/.cache/dein') | |
| call dein#begin('/Users/ユーザ名/.cache/dein') | |
| call dein#add('/Users/ユーザ名/.cache/dein/repos/github.com/Shougo/dein.vim') | |
| " ale に乗り換えたい... | |
| call dein#add('scrooloose/syntastic') |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| </head> | |
| <body> | |
| <div id="app"> | |
| <header> | |
| <button v-on:click="show=!show">切り替え</button> | |
| </header> |
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
| <script src="https://cdn.jsdelivr.net/npm/vue@2.6.7/dist/vue.js"></script> | |
| <script> | |
| // DOM が描画されるまで待つ | |
| setTimeout(vue, 1000); | |
| function vue() { | |
| new Vue({ |
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
| """Send an email from Gmail. | |
| Before execute this code, you have some tasks. | |
| 1) for temporary | |
| Turn on the flag "Allow less secure apps" | |
| from the follwoing link. | |
| https://myaccount.google.com/lesssecureapps | |
| or |
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
| # 偶数だけ取得します。 | |
| lst = [1, 2, 3, 4, 5, 6, 7] | |
| new_lst = list(filter(lambda x: x % 2, lst)) | |
| print(new_lst) | |
| # [1, 3, 5, 7] |
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
| # | |
| # そのまま対話モード >>> に | |
| # コピペで実行できます。 | |
| # | |
| # | |
| # 浅いコピー copy と深いコピー deepcopy の違いを示します。 | |
| # | |
| import copy | |
| import json |
OlderNewer