file object: seek and close?
Peter Otten
__peter__ at web.de
Thu Sep 18 14:30:45 EDT 2003
Shu-Hsien Sheu wrote:
> Hi,
>
> I did some tests and it seems that it was the line that I defined list
> as a pdbdict0 object was causing the problem.
>
> If I remove the line:
>
> list = pdbdict0()
>
This is really strange. I still cannot reproduce the error.
>
> class pdbdict0(dict):
> def __init__(self):
> super(dict, self).__init__()
> self['header'] = ''
> self['compnd'] = []
>
Wouldn't that be:
class pdbdict0(dict):
def __init__(self):
super(pdbdict0, self).__init__(self)
self['header'] = ''
self['compnd'] = []
or better:
def bdbdict0():
return {"header": "", "compnd": []}
While the pdbdict0 implementation seems broken, I have no clue what causes
the file to be closed.
Totally unrelated: Don't use list and type as variable names. They are
already used as built-in classes.
Peter
More information about the Python-list
mailing list