Python3系のmap()について質問です。
mapの実装を見ると、厳密にはmap()は関数ではなくmapクラスのインスタンスを返していると思うのですが、map関数であっているのでしょうか?
その他サイトや書籍、リファレンス等を見てもmap関数と書かれていてモヤモヤします。。
別にmapがインスタンス作っていようがインスタンスを返す関数だろうが、使い手側としては変わらないのですが、気になったので質問させていただきました。
http://www.sejuku.net/blog/24759
https://docs.python.jp/3/library/functions.html
python
1class map(object): 2 """ 3 map(func, *iterables) --> map object 4 5 Make an iterator that computes the function using arguments from 6 each of the iterables. Stops when the shortest iterable is exhausted. 7 """ 8 def __getattribute__(self, *args, **kwargs): # real signature unknown 9 """ Return getattr(self, name). """ 10 pass 11 12 def __init__(self, func, *iterables): # real signature unknown; restored from __doc__ 13 pass 14 15 def __iter__(self, *args, **kwargs): # real signature unknown 16 """ Implement iter(self). """ 17 pass 18
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/19 08:19
2017/10/19 08:20
2017/10/19 10:04
2017/10/20 06:12