In the PEP 8 Style Guide for Python Code , the first rule specified in the Naming Convention is the principle of redefinition.
Redefinition principleNames visible to the user as public parts of the API must conform to conventions that reflect usage, not implementation.
Names visible to the user as public parts of the API must conform to conventions that reflect usage, not implementation.
The PEP guidelines do not provide any additional details or examples that have left me unsure of what this rule actually means.
What is the basic principle in PEP 8? When does this rule apply?
, , , .
sorted() vs list.sort.
sorted()
list.sort
for element in sorted(my_list): ...
:
for element in sort(my_list): ... for element in my_list.sort(): ... for element in my_list.sorted(): ...
API , , . sorted .sort .
sorted
.sort
, Python /.
Python , , , - . Python ", " Python . , , , .
Source: https://habr.com/ru/post/1689267/More articles:Split a string every nth character to the right? - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1689263/change-names-in-dots-to-characters&usg=ALkJrhizAwWYKm2U4S6vFqil6PXZFCNepAПроблемы с Haskell Yesod - linuxCan we define “function declaration” as well as “function statement”? - javascriptError sending Webpack to SCSS @import SCSS - cssHow to get data back from shell (PHP) script - command-lineHow to start a sonarkwa? - java-8Why is '[fx [1]]' not grammatical, but '[1 + x [1]]' is there? - syntaxWeb workers not working in lightning container due to SalesForce CSP - salesforceconvert string to list of objects using Java 8 - javaAll Articles