November 2001
Beginner
320 pages
5h 53m
English
Python is entirely object-based, this means that many Perl programmers will have to get used to working with a combination of objects, compatible operators, and the class-specific methods which can be used to manipulate them.
For example, consider the Perl code fragment below which creates an array and then sorts the results into a new array:
my @array = qw/fred bob alice/; my @sorted = sort @array;
Within Python we can create the new list (the Python array type) and then use the sort() method on the new object to create an ordered version.
array = ['fred','bob','alice'] array.sort()
Although the process still takes two lines, we've created only one list and haven't had to exchange any data with an additional function, everything ...