Hi Darren,
On 07/28/10 09:54 AM, Darren Kenny wrote:
Hi Keith,
[...]
Taken one step on this, but still need to figure out the logic for
solaris_install - specifically for creating/merging into
solaris_install/__init__.py...
Yup, we'll figure out how to transition that properly.
[...]
470-481: I'd recommend having separate functions for "insert one" and
"insert all items in an iterable". (See list.append vs. list.extend). It
provides a cleaner disjunction and allows for one to create and insert
"list like" DataObjects.
Do you mean that I should have two DataObject.insert_children methods - maybe
insert_child and insert_children?
Do you really think it's likely for there to be a DataObject sub-class that
would also be a list (when I say list here, I mean would match
isinstance(.., list) - not just allow [] type access).
Consider the reverse - what happens when I pass in a tuple of
DataObjects? Or any iterable that isn't strictly a subclass of list?
I this case it will throw an exception since we only allow DataObject or
list() to be passed - a tuple isn't supported here.
Do you think it would be better to support any iterable object?
But I still don't see a requirement to have separate methods...
I do think it would be better to support any iterable, to save us from
odd bugs and improve flexibility. There's certainly good arguments for
allowing tuples, and perhaps sets, and at that point it's likely easiest
to just take on iterables as whole.
After thinking about it for a bit, I think a single method could be
workable, with one condition - the check for whether to consider
"new_children" as a "list-like" or a single DataObject should do an
isinstance(new_children, DataObject) comparison. While it's possible
that a DataObject subclass could be "list-like", I doubt any list
subclasses will be DataObjects - and if they are, the caller probably
wants to insert the "container," as well as the items in the container,
into the DOC.
Agreed, and implemented in cud_dc gate.
While on this topic, I think these other cases of "isinstance(something,
list)" should be 'reversed' in a similar fashion: delete_children,
register_class
[...]
I FINALLY figured out what you were referring to here - missed that issue, and
have fixed it now. Thanks for your patience ;)
You're welcome, and thank you for yours!
- Keith
Thanks,
Darren.
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss