Python type comparison table

PHP has 'PHP type comparison tables' is there anything like that for Python?


Yes, here (also included image below):


Python is strongly typed; such a table is not required except between basic numeric types and basic string types. For numeric types, they are coerced to long (in 2.x) or float as required. For string types, things are not as simple and so unicode (in 2.x) should be used where possible.

>>> 3 > 2.4
>>> 'a' < u'あ'
>>> u'a' < 'あ'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3 in position 0: ordinal not in range(128)

Comparison across incompatible types in 2.x will not act as you expect.

>>> 2 < '3'
>>> 3 < '2'

Comparison across incompatible types in 3.x will fail.

3>> 2 < '3'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: int() < str()

Need Your Help

What is the different between Reference Assemblies and Public Assemblies in Visual Studio

visual-studio dll visual-studio-2013

I have been investigating some issues with Web Performance Test Plugins in Visual Studio 2013. When adding references to the necessary dlls (e.g. Microsoft.VisualStudio.QualityTools.WebTestFramewor...

RDLC : No page break - four sub reports within table/tablix

reporting-services ssrs-2008 reporting rdlc rdl

I have a situation where i have to display four reports based on checkboxes. So user can select different combination from four reports.