On Thu, Mar 12, 2009 at 03:36:22PM -0700, Christopher Lee wrote:
-> On Mar 12, 2009, at 2:15 PM, C. Titus Brown wrote:
->
-> > ---
-> > class MemSequence(SequenceBase):
-> > def _init_subclass(cls, db, **kwargs):
-> > cls.db = db
-> > db.seqInfoDict = kwargs['theDict']
-> > _init_subclass = classmethod(_init_subclass)
->
-> wouldn't it be clearer to make seqInfoDict an explicit named argument?
->
-> class MemSequence(SequenceBase):
-> def _init_subclass(cls, db, seqInfoDict, **kwargs):
-> cls.db = db
-> db.seqInfoDict = seqInfoDict
-> _init_subclass = classmethod(_init_subclass)
A few quick comments:
you have to change _init_subclass like so:
def _init_subclass(cls, db, seqInfoDict={}, **kwargs):
and then instantiate your SequenceDB class like so:
memdb = SequenceDB(seqInfoDict=newdb, itemClass=MemSequence)
in order to get the kwargs to unpack properly (and to directly use
SequenceDB). This is as opposed to
memdb = MemSequenceDB(newdb)
which I think is more explicit. I'm not sure what the right tradeoff
is, though; I agree that explicitly grabbing 'theDict' from kwargs,
at the top, is also pretty ugly.
cheers,
--titus
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pygr-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pygr-dev?hl=en
-~----------~----~----~----~------~----~------~--~---