About 74,900 results
Open links in new tab
  1. python - Type hinting a collection of a specified type - Stack …

    In September 2015, Python 3.5 was released with support for Type Hints and includes a new typing module. This allows for the specification of types contained within collections. As of …

  2. What are type hints in Python 3.5? - Stack Overflow

    Sep 14, 2015 · One of the most talked-about features in Python 3.5 is type hints. An example of type hints is mentioned in this article and this one while also mentioning to use type hints …

  3. type hints (warnings) for Python in VS Code - Stack Overflow

    Aug 16, 2023 · I enjoy using type hinting (annotation) and have used it for some time to help write clean code. I appreciate that they are just hints and as such do not affect the code. But today I …

  4. python - How do I add default parameters to functions when …

    If I have a function like this: def foo (name, opts= {}): pass And I want to add type hints to the parameters, how do I do it? The way I assumed gives me a syntax error: def foo (name: str, …

  5. How to specify multiple types using type-hints - Stack Overflow

    723 I have a function in python that can either return a bool or a list. Is there a way to specify the types using type hints? For example, is this the correct way to do it?

  6. python - How should I use the Optional type hint? - Stack Overflow

    Side note: Unless your code only has to support Python 3.9 or newer, you want to avoid using the standard library container types in type hinting, as you can't say anything about what types …

  7. python - Pythonic type hints with pandas? - Stack Overflow

    May 10, 2017 · import pandas as pd def csv_to_df(path): return pd.read_csv(path, skiprows=1, sep='\t', comment='#') What is the recommended pythonic way of adding type hints to this …

  8. python - Type hints in namedtuple - Stack Overflow

    Dec 14, 2015 · ^^ While the keyword-argument syntax mentioned by @MarkedasDuplicate still works (tested on Python 3.10.9 (tags/v3.10.9:1dd9be6)), it was removed from the docstrings in …

  9. python - Type hints: solve circular dependency - Stack Overflow

    Nov 21, 2015 · 7 If you are on Python 3.7+, use from __future__ import annotations as mentioned in another answer. However, if you cannot use 3.7 yet due to OS limitation (like Cygwin as of …

  10. How to set the python type hinting for a dictionary variable?

    Oct 1, 2018 · @BurgerBurglar I WISH more of python reminded me of Java... :D Changing the case of a reference class to lower case because it is prettier rather than referencing the class …