About 98,700 results
Open links in new tab
  1. coding style - What are the most common Python docstring …

    Mar 31, 2017 · The Google style guide contains an excellent Python style guide. It includes conventions for readable docstring syntax that offers better guidance than PEP-257. For example: def square_root(n): """Calculate the square root of a …

  2. What are the main differences between PEP8 and Google Python …

    Mar 10, 2020 · the main difference is that Google Python Style comes with more details about how to write code, for example how to write your docstrings or when to use aliases for a variable, this are not specified in the PEP8

  3. What is the common header format of Python files?

    Apr 28, 2015 · As a DOC & Author credit, I like simple string in multiline. Here an example from Example Google Style Python Docstrings # -*- coding: utf-8 -*- """Example Google style docstrings. This module demonstrates documentation as specified by the `Google Python Style Guide`_. Docstrings may extend over multiple lines.

  4. python - Multiple imports according to google style guide - Stack …

    Jun 18, 2017 · I do not understand what is written in Google Python Style Guide about multiple imports per line. Is it ok (according to Google Style Guide) to have it this way: from wagtail.wagtailimages.blocks import ImageChooserBlock, EmbedBlock or do I …

  5. Google Python Style Guide & relative imports - Stack Overflow

    Jan 12, 2022 · Google Python Style Guide says: Do not use relative names in imports. Even if the module is in the same package, use the full package name. This helps prevent unintentionally importing a package twice. What would be a sample setup that incurs importing a package twice?

  6. python - Type annotations with google style docstrings - Stack …

    Jan 18, 2021 · According to the Google Python Style Guide: "The description should include required type(s) if the code does not contain a corresponding type annotation." The Sphinx Docs also encourage this in their example code: def function_with_pep484_type_annotations(param1: int, param2: str) -> bool: """Example function with PEP 484 type annotations.

  7. What is the naming convention in Python for variables and …

    The Google Python Style Guide has the following convention: module_name, package_name, ClassName, method_name, ExceptionName, function_name, GLOBAL_CONSTANT_NAME, global_var_name, instance_var_name, function_parameter_name, local_var_name. A similar naming scheme should be applied to a CLASS_CONSTANT_NAME

  8. Common coding style for Python? - Stack Overflow

    May 12, 2010 · PEP 8 is pretty much "the root" of all common style guides. Google's Python style guide has some parts that are quite well thought of, but others are idiosyncratic (the two-space indents instead of the popular four-space ones, and the CamelCase style for functions and methods instead of the camel_case style, are pretty major idiosyncrasies).

  9. Why choose module level function over @staticmethod in Python ...

    How to understand the Google Python Style Guide that says: Never use @staticmethod unless forced to in order to integrate with an API defined in an existing library. Write a module level function instead. Well, you should understand it as Google's style guide.

  10. What is the correct way to document a **kwargs parameter?

    Jul 16, 2009 · Though you asked about sphinx explicitly, I would also point to the Google Python Style Guide. Their docstring example seems to imply that they don't call out kwargs specifically. (other_silly_variable=None) def fetch_bigtable_rows(big_table, keys, other_silly_variable=None): """Fetches rows from a Bigtable.

Refresh