class Item ( object ): def __init__( self ): self._FullName = '' self._Recovery = 0 self._Exporter = SimpleItemExporter (); # <----? Don't understand
Bummer, I was hoping to consider myself at the tip of intermediate python programming <sigh>... This is the first time I have ever seen a variable set to what appears to be a function address(?). Since I am at work I can't copy paste this thing yet. Is SimpleItemExporter from the parent class, object? I am assuming Item extends or inherits (or whatever the right "word" is) from object. In the above code example, SimpleItemExporter is a class and Self._Exporter is an instance of that class. Yes, SimpleItemExporter does in fact inherit from object. Python lacks the 'new' keyword which may have made that line of code more clear but, in plain English this is what the line means... Create a new SimpleItemExporter and let me access it through the variable self._Exporter. By the way, I'm avoiding the notion of function address by implementing the concept of interfaces in these examples. Please Let us know if your questions about that line of code are answered. Once clear, we can move on to even more cool things in this code. There is a little more to the story relating to the whole self bit, but since I'm at work now too, I'll let someone else get into that for now. -- Ronald Weidner _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor