Commit dd3fc0f3 authored by Chris McDonough's avatar Chris McDonough

Added new_or_existing method to StringKeyedHomogeneousItemContainer. Removed...

Added new_or_existing method to StringKeyedHomogeneousItemContainer.  Removed set method from StringKeyedHomogeneousItemContainer.
parent c859e075
......@@ -143,17 +143,26 @@ class HomogeneousItemContainer(Interface.Base):
"""
class StringKeyedHomogeneousItemContainer(HomogeneousItemContainer):
def set(self, k, v):
def new(self, k):
"""
Sets key k to value v. "k" must be a string, and "v" must support
the homogenous item container's subobject interface; a TypeError
is raised if either condition is untrue.
Creates a new subobject of the type supported by this container
with key "k" and returns it.
If an object already exists in the container with key "k", a
KeyError is raised.
"k" must be a string, else a TypeError is raised.
"""
def new(self, k):
def new_or_existing(self, k):
"""
Creates a new subobject of the type supported by this container
with key "k". "k" must be a string else a TypeError is raised.
If an object already exists in the container with key "k", it
is returned.
Otherwiser, create a new subobject of the type supported by this
container with key "k" and return it.
"k" must be a string, else a TypeError is raised.
"""
class TransientItemContainer(Interface.Base):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment