Skip to content

Commit

Permalink
PDB: implemented Entity.__delitem__ (Bug 2879)
Browse files Browse the repository at this point in the history
Same as detach_child. Also uncommented Chain.__delitem__.
  • Loading branch information
etal committed May 29, 2010
1 parent 835b444 commit 77e0ee3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Bio/PDB/Chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def __getitem__(self, id):
id=self._translate_id(id)
return Entity.__getitem__(self, id)

# def __delitem__(self, id):
# """
# Arguments:
# o id - (string, int, string) or int
# """
# id=self._translate_id(id)
# return Entity.__delitem__(self, id)
def __delitem__(self, id):
"""
Arguments:
o id - (string, int, string) or int
"""
id=self._translate_id(id)
return Entity.__delitem__(self, id)

def __repr__(self):
return "<Chain id=%s>" % self.get_id()
Expand Down
4 changes: 4 additions & 0 deletions Bio/PDB/Entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def __getitem__(self, id):
"Return the child with given id."
return self.child_dict[id]

def __delitem__(self, id):
"Remove a child."
return self.detach_child(id)

def __iter__(self):
"Iterate over children."
for child in self.child_list:
Expand Down

0 comments on commit 77e0ee3

Please sign in to comment.