Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Dave Angel
walterbyrd wrote: Example 5.6. Coding the FileInfo Class class FileInfo(UserDict): "store file metadata" def __init__(self, filename=ne): UserDict.__init__(self)(1) self["name"] =ilename(2) What I do not understand is the last line. I thought 'self' was

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Chris Rebert
On Wed, May 20, 2009 at 9:10 AM, walterbyrd wrote: > On May 20, 9:59 am, Marco Mariani wrote: > >> Do you know what a dictionary is? > > Yes, but I thought  a dictionary used curly brackets. Is the object a > dictionary? Indeed. Note how you're subclassing `UserDict` (its name is similar to `dic

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Diez B. Roggisch
walterbyrd wrote: > On May 20, 9:59 am, Marco Mariani wrote: > >> Do you know what a dictionary is? > > Yes, but I thought a dictionary used curly brackets. Is the object a > dictionary? foo = {"key" : "i'm the value of a dictionary"} print foo["key"] I suggest you read the tutorial: http:/

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread walterbyrd
On May 20, 9:59 am, Marco Mariani wrote: > Do you know what a dictionary is? Yes, but I thought a dictionary used curly brackets. Is the object a dictionary? -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread Marco Mariani
walterbyrd wrote: > I am sure this is totally simple, but I missing something. Do you know what a dictionary is? -- http://mail.python.org/mailman/listinfo/python-list

Trying to understand a very simple class - from the book "dive into python"

2009-05-20 Thread walterbyrd
Example 5.6. Coding the FileInfo Class class FileInfo(UserDict): "store file metadata" def __init__(self, filename=None): UserDict.__init__(self)(1) self["name"] = filename(2) What I do not understand is the last line. I thought 'self' was supposed to refer