PYTHON OPERATORS

Python supports a very similar set of operators to those supported by Perl. The major difference is that operators in Python tend to be consistent across all the different object types. We've already seen examples of this with the + and * operators. The other place where this has an effect are the comparison operators – Python uses only one set of operators which can be used for comparing numbers and strings, Perl uses different operator sets.

Also, the different parentheses and braces are used to define the object type, rather than being used to access information from different objects. For example, the [] brackets are used to create a list, and also to extract the information from any sequence type and dictionaries.

The operators ...

Get Perl To Python Migration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.