You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- 10<obligatory_rant> Python is a language for consenting adults. If you want to mark something private, simply prefix the name with an underscore, e.g. "_stringy_sum". Whether other developers will ignore this and invoke it anyway is a different problem. The canonical example I've seen for public/private is a toy "ATM" class - if your coworkers are trying to break into the ATM, you've got bigger problems than the fact that Python doesn't enforce private variables. </obligatory_rant>Blackhawk– Blackhawk2022-12-15 22:17:59 +00:00Commented Dec 15, 2022 at 22:17
- 3Why shouldn't stringy_sum have tests if this is useful?Stack Exchange Broke The Law– Stack Exchange Broke The Law2022-12-16 10:34:58 +00:00Commented Dec 16, 2022 at 10:34
- 1@user253751 Precisely because of this issue - if you want to change the code using stringy_sum but not its behaviour (i.e. refactor) then you are required to add or remove tests. The only utility of tests (according to this interpretation) is to verify behaviour. So either stringy_sum is part of the public API (behaviour) of the class, and should be tested, or it is used only implicitly, in which case the actual behaviour should be tested. If stringy_sum contains complex behaviour, then remodelling might make it a new unit in the system, which is used by foo and bar.preferred_anon– preferred_anon2022-12-16 11:11:57 +00:00Commented Dec 16, 2022 at 11:11
- @user253751 Of course I have. It's a natural thing to want. You asked why not, so I told you why not. Note the last sentence in particular.preferred_anon– preferred_anon2022-12-16 11:18:06 +00:00Commented Dec 16, 2022 at 11:18
Add a comment |
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you