About 50 results
Open links in new tab
  1. How can I determine a Python variable's type? - Stack Overflow

    Python doesn't have such types as you describe. There are two types used to represent integral values: int, which corresponds to platform's int type in C, and long, which is an arbitrary precision integer (i.e. …

  2. python - Determine the type of an object? - Stack Overflow

    Feb 9, 2010 · There are two built-in functions that help you identify the type of an object. You can use type() if you need the exact type of an object, and isinstance() to check an object’s type against …

  3. What's the canonical way to check for type in Python?

    Aug 3, 2014 · In Python, you can use the built-in isinstance() function to check if an object is of a given type, or if it inherits from a given type. To check if the object o is of type str, you would use the …

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

    Sep 20, 2025 · 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...

  5. strong typing - Is Python strongly typed? - Stack Overflow

    Jul 4, 2012 · Python is strongly, dynamically typed. Strong typing means that the type of a value doesn't change in unexpected ways. A string containing only digits doesn't magically become a number, as …

  6. 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 to_datetime() and …

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

  8. python - Immutable vs Mutable types - Stack Overflow

    Nov 9, 2011 · Mutable types can be changed in place. Immutable types can not change in place. That's the way python sees the world. It is regardless of how variables are passed to functions.

  9. Python naming conventions for modules - Stack Overflow

    Apr 2, 2009 · Just nib. Name the class Nib, with a capital N. For more on naming conventions and other style advice, see PEP 8, the Python style guide.

  10. python - What are the differences between type () and isinstance ...

    To summarize the contents of other (already good!) answers, isinstance caters for inheritance (an instance of a derived class is an instance of a base class, too), while checking for equality of type …