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

    In Python code, this shouldn't make a bit of difference because the interpreter automatically converts to long when a number is too large. If you want to know about the actual data types used in the …

  2. python - Viewing all defined variables - Stack Overflow

    Mar 11, 2009 · You do get a list of the variables, which answers the question, but with incorrect types listed beside them. This was not obvious in your example because all the variables happened to be …

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

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

  4. Explicitly Define Datatype in Python Function - Stack Overflow

    Python is a strongly-typed dynamic language, which associates types with values, not names. If you want to force callers to provide data of specific types the only way you can do so is by adding explicit …

  5. Python Variable Declaration - Stack Overflow

    Jun 13, 2012 · As such, Python's names (a better term than "variables", arguably) don't have associated types; the values do. You can re-apply the same name to anything regardless of its type, but the …

  6. How to check if a variable's type is primitive? - Stack Overflow

    Jun 17, 2011 · In Python, everything is an object; even ints and bools. So if by 'primitive' you mean "not an object" (as I think the word is used in Java), then there are no such types in Python. If you want to …

  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 and …

  8. how to convert type of variables in python? - Stack Overflow

    Sep 9, 2016 · In fact, in the python script, it receive some strings from sys.argv. And then it will assign these strings into some predefined variables in this script. These predefined variables may be int, list, …

  9. python - Use of Generic and TypeVar - Stack Overflow

    Aug 11, 2021 · A literal value can be used instead of variables, and a literal type can be used instead of type variables – provided these are the only values/types applicable. Since the Python language …

  10. How to declare variable type, C style in Python - Stack Overflow

    Oct 14, 2010 · In Python, objects exist out there in the interpreter's memory jungle, and you can give them names and remember where to find them using variables. Your variable doesn't have a type in …