Simple Object assignment giving me errors

Nir nirchernia at gmail.com
Wed Feb 12 16:18:02 EST 2014


This is from the book 'dive into python'. I am trying to define jeez as being an instance of FileInfo.

class UserDict(object):
	def __init__(self, dict = None):
		self.data = {}
		if dict is not None: self.update(dict)

class FileInfo(UserDict):
	def __init__(self, filename=None):
		UserDict.__init__(self)
		self["name"] = filename


jeez = FileInfo("yo")




I get a TypeError: 'FileInfo' object doesn't support item assignment .

Am I missing something?



More information about the Python-list mailing list