On Dec 3, 2007, at 5:28 PM, johnf wrote:

> My "Learning Python (2nd Editon)" O'Reilly Authors Mark Lutz and  
> David Ascher
> refers to 'a' in the following:
>
> a = 100
>
> as a variable.  It's all over the book that way.  It also implies  
> that 'a' is
> an object reference.  This follows my thinking as in other  
> languages.  What
> am I missing?


        The best explanation I have found is this paper from David Goodger:

http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html

        Load that page, and then scroll down to the section beginning with  
the header: Other languages have "variables". The distinction between  
the boxes and the tags is helpful in making things clear.

        I don't know why the authors of your book chose to use the term  
'variable'. It is generally frowned upon in Python, as it means  
something quite different in most languages.

> I recall you telling me all Dabo objects have a unique identifier.   
> Re-reading
> the def for RegID you are of course correct that the RegID is not  
> automaticly
> assigned.  Again what am I missing?  Do objects have a unique  
> identifier or
> do I just have a faulty memory?

        GUI objects have a unique name among their siblings. If necessary,  
Dabo will automatically adjust a name to be unique among siblings by  
appending a numeric suffix to the class name (unless you explicitly  
supply a name).

        Note that these names are only unique among siblings; i.e., objects  
in the same container with the same parent. There could be an  
unlimited number of objects with the same 'Name' in a form, as long  
as each is in its own container.

        Given this, you can always refer to an object by a dot notation of  
its containership: form.pageframe.page2.panel1.panel2.panel3.textbox1  
is distinct from form.pageframe.page2.panel2.panel2.panel3.textbox1.  
But these long names are fragile, and renaming anything in that chain  
will break any reference that relies on the fully qualified path  
name. Hence the need for something like RegID: if I need to refer to  
an object, it is sufficient to know its RegID in order to refer to it  
by form.RegID; you can rename anything in its containership  
hierarchy, or even move it to a completely different location on the  
form, and the reference will not break.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com




_______________________________________________
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]

Reply via email to