pep8.org | - PEP 8 , for Humans | Dataset library
kandi X-RAY | pep8.org Summary
kandi X-RAY | pep8.org Summary
PEP 8, for Humans.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pep8.org
pep8.org Key Features
pep8.org Examples and Code Snippets
Community Discussions
Trending Discussions on pep8.org
QUESTION
From PEP 8 we know that single leading underscore in function name is "internal use" indicator, which means that this function is intended for internal use only and might be ignored by some import
s.
Recently I started working on a project where I found a lot of places where class methods are defined in both versions and are used (for example) this way:
...ANSWER
Answered 2019-Jul-31 at 13:45Though you may not commonly see this, it is not bad practice; although, it does have specific use cases.
Normally methods can be broken into two parts, its public version and its private version. The public method basically adds an API layer which can then decide which private method to call or do some data manipulation on the inputs to conform it to meet the private methods requirements. The private method deals with handling the class private attributes themselves.
Adding this separation layer can be convenient.
Here is a basic example just to illustrate the idea. Though for something this simple you can just do it all in the single method.
QUESTION
I am trying to determine some best practices of function imports and PEP 8 does not explicitly speak about this, in fact the PEP 8 imports section is relatively small. I was wondering what the best practices were when importing using abbreviations.
For example:
...ANSWER
Answered 2019-Apr-23 at 21:05I think it depends on your audience. If your audience is familiar with the function you are abbreviating or if you providing documentation for the function, then it certainly can make code more readable. However, if you abbreviate every single obscure function you import (even if you only use it once), then it becomes significantly less readable and a pain to understand.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pep8.org
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page