June 2000
Intermediate to advanced
556 pages
8h 45m
English
Python is what is known as a dynamically typed language. That is, its variables are not restricted to referencing objects of any particular type by the language. In Python, variables spring into existence as required. They do not need to be declared beforehand. Moreover, a variable x can be an integer one minute, a string the next, and an user-defined object the next. This is a very flexible way of doing things and can be a great boon for certain types of programming tasks. However, it does mean you have to be careful, as the example below will illustrates.
CD-ROM reference=6042.txt >>> def DaysFromHours(h): ...return h / 24 ... >>> DaysFromHours(240) 10 >>> DaysFromHours("Hello World") Traceback (innermost ...
Read now
Unlock full access