On Monday 02 April 2007 07:46, Ed Leafe wrote: > Let me clear up some terminology differences between VFP and > Python. In VFP, objects have properties and methods. In Python, objects > have attributes and method. 'Property' is a special construct; about the > closest thing in VFP is a VFP prop with access and assign methods. VFP > requires that all properties and methods be declared in the class > definition, or explicitly added with ADDPROPERTY(). Python is more dynamic; > you can simply say 'myInstance.foo = 3", and that object instance has a new > attribute named 'foo'. Let me add a hint. Lets say that myInstance has an attribute of "foos" and you want to set the value to 3 but you type: myInstance.foo = 3
What you have done is add an attribute to "myInstance" called "foo". The compiler does not complain - it's all legal code. Miss spelling (including case) has tripped me up several times. It's specially tuff when you don't know all the available attributes of a dabo class. But adding an attribute dynamicly is also very cool. You can do the following: myInstance = SomeClass(self) myInstance.newAttribute = "new attribute" -- John Fabiani _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]
