About 9,130,000 results
Open links in new tab
  1. How to set the python type hinting for a dictionary variable?

    Oct 1, 2018 · Python likely derived this naming scheme from C or C++. In C structs are typically lower case (though there are a lot of people that use pascal case), and in C++ people typically …

  2. How can I determine a Python variable's type? - Stack Overflow

    How to determine the variable type in Python? So if you have a variable, for example: one = 1 You want to know its type? There are right ways and wrong ways to do just about everything in …

  3. Get a list of all the encodings Python can encode to

    Nov 13, 2009 · I am writing a script that will try encoding bytes into many different encodings in Python 2.6. Is there some way to get a list of available encodings that I can iterate over?

  4. python - Change column type in pandas - Stack Overflow

    You have four main options for converting types in pandas: to_numeric() - provides functionality to safely convert non-numeric types (e.g. strings) to a suitable numeric type. (See also …

  5. python - Type annotations for *args and **kwargs - Stack Overflow

    May 4, 2016 · I'm trying out Python's type annotations with abstract base classes to write some interfaces. Is there a way to annotate the possible types of *args and **kwargs? For example, …

  6. Converting numpy dtypes to native python types - Stack Overflow

    Feb 26, 2012 · Python maps numpy dtypes to python types, I'm not sure how, but I'd like to use whatever method they do. I think this must happen to allow, for example, multiplication (and …

  7. python - Immutable vs Mutable types - Stack Overflow

    Nov 9, 2011 · All variables can be reassigned in Python, whether they were previously assigned to mutable or immutable types. However, the behavior of reassignment is different for mutable …

  8. 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 …

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

    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? def foo (id) -> list or b...

  10. types - How do you set a conditional in python based on …

    I know you can check datatypes in python, but how can you set a conditional based on the datatype? For instance, if I have to write a code that sorts through a dictionary/list and adds up …