Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [types]

Types, and type systems, are used to enforce levels of abstraction in programs.

7555 votes
68 answers
1.3m views

What is the difference between String and string in C#?

What are the differences between these two, and which one should I use? string s = "Hello world!"; String s = "Hello world!";
2273 votes
57 answers
2.4m views

Check if a value is an object in JavaScript

How do you check if a value is an object in JavaScript?
Danny Fox's user avatar
  • 40.2k
2191 votes
22 answers
4.0m views

How to determine a Python variable's type?

How do I see the type of a variable? (e.g. unsigned 32 bit)
user46646's user avatar
  • 158k
2174 votes
15 answers
2.3m views

Determine the type of an object? [duplicate]

Is there a simple way to determine if a variable is a list, dictionary, or something else?
Justin Ethier's user avatar
1925 votes
18 answers
1.6m views

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

How do I check if an object is of a given type, or if it inherits from a given type? How do I check if the object o is of type str? Beginners often wrongly expect the string to already be "a ...
Herge's user avatar
  • 21.8k
1911 votes
16 answers
1.5m views

Type Checking: typeof, GetType, or is?

I've seen many people use the following code: Type t = typeof(SomeType); if (t == typeof(int)) // Some code here But I know you could also do this: if (obj1.GetType() == typeof(int)) // Some ...
jasonh's user avatar
  • 30k
1562 votes
8 answers
895k views

What are the differences between type() and isinstance()? [duplicate]

What are the differences between these two code snippets? Using type: import types if type(a) is types.DictType: do_something() if type(b) in types.StringTypes: do_something_else() Using ...
abbot's user avatar
  • 27.8k
1543 votes
17 answers
4.0m views

Change column type in pandas

I created a DataFrame from a list of lists: table = [ ['a', '1.2', '4.2' ], ['b', '70', '0.03'], ['x', '5', '0' ], ] df = pd.DataFrame(table) How do I convert the columns to ...
user avatar
1227 votes
9 answers
456k views

What are POD types in C++? [duplicate]

I've come across this term POD-type a few times. What does it mean?
oz10's user avatar
  • 157k
1225 votes
14 answers
663k views

What are "named tuples" in Python?

What are named tuples and how do I use them? When should I use named tuples instead of normal tuples, or vice versa? Are there "named lists" too? (i.e. mutable named tuples) For the last ...
Denilson Sá Maia's user avatar
1131 votes
8 answers
275k views

What is the difference between old style and new style classes in Python?

What is the difference between old style and new style classes in Python? When should I use one or the other?
readonly's user avatar
  • 351k
1065 votes
22 answers
1.4m views

How to check if type of a variable is string? [duplicate]

Is there a way to check if the type of a variable in python is a string, like: isinstance(x,int); for integer values?
c_pleaseUpvote's user avatar
1031 votes
13 answers
596k views

Difference between text and varchar (character varying)

What's the difference between the text data type and the character varying (varchar) data types? According to the documentation If character varying is used without length specifier, the type ...
Adam Matan's user avatar
  • 134k
949 votes
12 answers
815k views

Limit file format when using <input type="file">?

I'd like to restrict the type of file that can be chosen from the native OS file chooser when the user clicks the Browse button in the <input type="file"> element in HTML. I have a feeling it's ...
Bojangles's user avatar
  • 101k
932 votes
11 answers
754k views

How to create a new object instance from a Type

One may not always know the Type of an object at compile-time, but may need to create an instance of the Type. How do you get a new object instance from a Type?
tags2k's user avatar
  • 83.7k

15 30 50 per page
1
2 3 4 5
1928