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 3 of 4  >>


Weak Typing and the Standard Library

Bill Venners: To what extent do Python's weak typing and libraries help programmers feel productive?

Guido van Rossum: Weak typing probably helps you feel productive, because it lets you bend the rules a bit when deciding what goes into your array. You can have an array of numbers that occasionally has something else inside, if that doesn't bother you. A single sort method sorts arrays of completely heterogeneous elements, as long as you can compare them individually. You don't have to commit to integers and floating point numbers, for example. They all mix properly. You also have long integers, which are arbitrary precision integers. In many cases, this is useful—either because you need just a little more than 32 bits, or because you need a lot more than 32 bits. Long integers are available in Java, but they're in a separate package and are much harder to use because you don't have operator overloading. In Python, you can just write x + y, and it doesn't matter whether x and y are small integers or integer numbers with several thousand bits.

People also feel more productive due to the "batteries included" feeling: the standard library includes many things. The standard library has implementations of the various Internet protocols—HTTP, FTP, NNTP, IMAP, POP, SMTP. There's a higher-level API to which you just give a URL and it returns something that acts like a file. You can just read bytes from it and it gives the data corresponding to that URL on the remote site. A lot of necessary functionality is already in the libraries, available with minimal typing.

In addition to the standard library, the Python community has produced many third- party libraries. For years the standard library didn't have cookie support, but there was an excellent third-party cookie module. About one or two years ago that cookie module was added to the standard library; however, it was available to people who needed it long before then. All those aspects let people feel more productive.

<<  Page 3 of 4  >>

Sponsored Links

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