Class coding and usage - Python Discussions
Apr 9, 2023 ... Following are a couple of suggestions. See Class Names in PEP 8 – Style Guide for Python Code. ... As an example, I have implemented a function ...
Apr 9, 2023 ... Following are a couple of suggestions. See Class Names in PEP 8 – Style Guide for Python Code. ... As an example, I have implemented a function ...
Mar 8, 2025 ... It prescribes the function or method's effect as a command (“Do this”, “Return that”), not as a description; e.g. don't write “Returns the ...
I think a Markdown code-block style syntax is pretty useful, with that, we can event highlight the multi-line str areas as code of some programming languages. In this syntax, the word or sentence on the same line immedi…
Feb 25, 2024 · This is the hub for discussion around all aspects of Python’s documentation.
Mar 27, 2024 ... The goal is to create a Python method that takes an unindented string ... A working code example that handles the hierarchical list parsing ...
I am concerned about LLM code in PythonPythonU (Python Unicode) - Separating programming...
Jul 15, 2023 · Hello, I am new to Python and programming and i find it difficult to search for specific topics. For example i was searching for string methods and i get a lot of results but not the one i am looking for. I managed to find the link trough google String Methods but i don’t understand why it doesn’t show up in the documentation search results? Is there a specific way to search for what you ...
May 11, 2025 ... string evaluation. API Definition. A new API will be introduced to create lazy-loaded strings: .. code-block:: C PyObject* ...
Syntax of the method: str.replace(old, new, count=-1). What if replace could accept two lists instead of two strings. Often I find in code: text.replace(a, b).replace(c, d).
Nov 22, 2025 · Hello everyone, I’m a beginner in Python, and while browsing the Wikipedia page for the language I found a code example that raised some questions for me regarding style and best practices.
Aug 21, 2025 ... First of all, you're not giving it a list of values - you're giving it a tuple of values, where each value is a list.
Discussions on Python.org. Explicit parameter list in function documentation.This doesn’t make sense for all functions however, for example listing each parameter for pow would be unnecessarily verbose. Ideally this could apply too the function’s docstring as well.
Jul 11, 2023 · Hello, I am attempting to teach myself Python using MIT’s OCW. I am trying to program a Hangman game using functions and I need to compare a string (letters_guessed) to the word the computer chose (secret_word (also a string)). I want to do a simple ‘if’ statement, but since I won’t be guessing the letters in the correct order, is there a way to compare the string without a simple ...
Feb 11, 2023 ... I propose adding an annotation to document exceptions that are explicitly raised within the function or called code to facilitate static- ...
Feb 15, 2023 · There is no reason to have the vowels also in a list: [ 'aeiou']. I’d either do a list of characters or just iterate the string directly. strings have a count method you could use to count how many times a substring is in a string. Built-in Types — Python 3.11.2 documentation
Aug 26, 2026 ... Do you see this as being language-level guarantees, or specific to the CPython implementation? In my view, it's better to keep things simple and ...
Feb 12, 2024 · Does this mean that each of my functions must have a docstring, even if it is a single line or the only one in the file? Or if this function is the only one written exclusively for the programming competitions?
Oct 19, 2025 ... PEP 8 says “For sequences, (strings, lists, tuples) ... Read this section of the PEP: PEP 8 – Style Guide for Python Code | peps.python.org.