homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: FAQ: len() is still function for good reason.
Type: Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, methane, miss-islington, terry.reedy, vstinner
Priority: normal Keywords: patch

Created on 2016年08月03日 09:01 by methane, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
faq-function-method.patch methane, 2016年12月26日 12:00 review
Pull Requests
URL Status Linked Edit
PR 8432 merged methane, 2018年07月24日 06:21
PR 8577 merged miss-islington, 2018年07月31日 05:49
PR 8578 merged miss-islington, 2018年07月31日 05:50
PR 8579 merged miss-islington, 2018年07月31日 05:51
Messages (7)
msg271881 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2016年08月03日 09:01
https://docs.python.org/3/faq/design.html#why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list
> The major reason is history.
...
> but it’s a part of Python, and it’s too late to make such fundamental changes now. The functions have to remain to avoid massive code breakage.
People seeing this answer may think "it's bad design, but remains for historical reason."
But there is more positive reason why len is still function.
http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm 
msg272051 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016年08月05日 18:53
I agree. We do not need to semi-apologize for having generic functions be builtin generic functions.
msg284023 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2016年12月26日 12:00
I can't write long English document.
Can I quote Guido's mail instead?
msg322721 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2018年07月31日 05:49
New changeset c48e26dcadbff8620bb5881d3bd148fc8894d0ef by INADA Naoki in branch 'master':
bpo-27671: Update FAQ about why len is function (GH-8432)
https://github.com/python/cpython/commit/c48e26dcadbff8620bb5881d3bd148fc8894d0ef
msg322723 - (view) Author: miss-islington (miss-islington) Date: 2018年07月31日 05:54
New changeset a621f406402e05febb302cf31962e9d2d747d8f6 by Miss Islington (bot) in branch '3.7':
bpo-27671: Update FAQ about why len is function (GH-8432)
https://github.com/python/cpython/commit/a621f406402e05febb302cf31962e9d2d747d8f6
msg322724 - (view) Author: miss-islington (miss-islington) Date: 2018年07月31日 05:56
New changeset 0b376eb0d63e0c51ed55c620b40edae6ded4ea48 by Miss Islington (bot) in branch '3.6':
bpo-27671: Update FAQ about why len is function (GH-8432)
https://github.com/python/cpython/commit/0b376eb0d63e0c51ed55c620b40edae6ded4ea48
msg322725 - (view) Author: miss-islington (miss-islington) Date: 2018年07月31日 05:58
New changeset dc9039da239ee572eaaf56e4a026be1fc4d74e24 by Miss Islington (bot) in branch '2.7':
bpo-27671: Update FAQ about why len is function (GH-8432)
https://github.com/python/cpython/commit/dc9039da239ee572eaaf56e4a026be1fc4d74e24
History
Date User Action Args
2022年04月11日 14:58:34adminsetgithub: 71858
2018年07月31日 07:37:40methanesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018年07月31日 05:58:14miss-islingtonsetmessages: + msg322725
2018年07月31日 05:56:29miss-islingtonsetmessages: + msg322724
2018年07月31日 05:54:27miss-islingtonsetnosy: + miss-islington
messages: + msg322723
2018年07月31日 05:51:33miss-islingtonsetpull_requests: + pull_request8087
2018年07月31日 05:50:33miss-islingtonsetpull_requests: + pull_request8086
2018年07月31日 05:49:40miss-islingtonsetpull_requests: + pull_request8085
2018年07月31日 05:49:26methanesetmessages: + msg322721
2018年07月24日 06:21:52methanesetstage: patch review
pull_requests: + pull_request7957
2017年01月03日 14:35:54vstinnersetnosy: + vstinner
2016年12月26日 12:00:29methanesetfiles: + faq-function-method.patch
keywords: + patch
messages: + msg284023
2016年08月05日 18:53:42terry.reedysetnosy: + terry.reedy
messages: + msg272051
2016年08月03日 09:01:26methanecreate

AltStyle によって変換されたページ (->オリジナル) /