Logo

Programming-Idioms

History of Idiom 94 > diff from v23 to v24

Edit summary for version 24 by programming-idioms.org:
[Python] 2 ways -> 2 impls

Version 23

2016-10-26, 12:11:43

Version 24

2016-10-26, 12:12:01

Idiom #94 Print type of variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

Idiom #94 Print type of variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

Code
print(type(x))
# OR
print(x.__class__)
Code
print(type(x))