The Artima Developer Community
Sponsored Link

Programming at Python Speed
A Conversation with Guido van Rossum, Part III
by Bill Venners
January 27, 2003

<<  Page 2 of 4  >>


Python's Powerful Data Types

Bill Venners: Do you consider less finger typing the main source of productivity when programming in Python? Why do people feel more productive?

Guido van Rossum: Another source of productivity is Python's powerful built-in data types. Take arrays, for example. Python does not require you to declare an array size. You don't need to worry that what you want to hold doesn't fit in the number of elements you've declared. Our array type is flexible. It has maybe a dozen methods. You can insert elements in the middle and everything else just moves up automatically. You can delete. You can also slice: work on a slice of an array at a time. If you want a function to act on a piece of an array, for example, you can just pass a slice as a single argument. You don't need to pass in the original array with a start-and-stop index.

Python has a very efficient and powerful dictionary type, which is like an associative array or hash. The dictionary type is used a lot internally by the Python implementation. That almost guarantees that it is efficient, because we spent a lot of time making the language efficient. But you can use the same dictionary data type for your application. Dictionary is probably the main data type that every application uses.

Over the years Python's data types have collected a lot of useful functionality. The data types are powerful. That makes Python very powerful. And yet because Python has a very small set of data types, it doesn't feel like you have to spend a year learning the language before you know everything that's there. The minimal finger typing and powerful data types work together to make your program small, and make you feel more productive.

<<  Page 2 of 4  >>

Sponsored Links

Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use