Extreme Object Orientation


In Python, everything is an object. They have identities, types, and values, but also inherent properties and methods. For example, you can determine the index of a given substring using a string object's index method:

import string greeting = "Hello World! It's nice to meet you!" location = greeting.index("nice") print location 

You can create your own objects with the class statement. User-defined classes can have class variables and class methods, which govern all instances of the class. Each instance of a class can, in turn, have its own instance variables that don't apply to other instances.



SUSE Linux 10 Unleashed
SUSE Linux 10.0 Unleashed
ISBN: 0672327260
EAN: 2147483647
Year: 2003
Pages: 332

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net