Questions tagged [types]
Types, and type systems, are used to enforce levels of abstraction in programs.
types
28,917
questions
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?
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)
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?
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 ...
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 ...
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 ...
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 ...
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?
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 ...
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?
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?
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 ...
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 ...
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?