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
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
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:/
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
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
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