[Bioperl-l] PrimarySeq POD changes
Chris Fields
cjfields at uiuc.edu
Wed Sep 27 23:47:55 UTC 2006
> Chris Fields wrote:
...
> >
> > This could be changed to accept either named arguments and regular
> > arguments, just like the docs state:
> >
> > my ($value,$alphabet) = $self->_rearrange([qw(SEQ ALPHABET)],
> @args);
> >
> > my $old_api = (!(grep {$_ =~ /(?:seq|alphabet)/} @args)) ? 1 : 0;
> > ($value, $alphabet) = @args if $old_api;
>
> Well, this new feature could be added of course, but it overcomplicated
> things for a two argument method. I don't think we should slow things
> down with a _rearrange call, especially in PrimarySeq seq() which must
> get called a hell of a lot.
>
> Also, the reason I was looking at this in the first place is that I'm
> inheriting and partially overriding it, so the simpler its inputs are
> the better.
I tested _rearrange() using Time::HiRes and find it adds relatively little
extra time to a method call (and it adds very little time to this one).
However, I find using this an adequate tradeoff for passing more concise
arguments. That way you're not passing something like:
$primseq->seq(undef, 'dna');
just to fill in the argument list. I would consider this a simpler, more
precise argument:
$primseq->seq(-alphabet => 'dna');
Obviously, in this case you would never do that (you would set the alphabet
using $primseq->alphabet()), yet I have seen and corrected methods where
'undef' was passed to fill an argument list, just to pass in the second
argument. I don't consider that a great practice, but that's my opinion.
Anyway, I believe the POD signaled an intent to do something like this that
was never brought to fruition.
Chris
Christopher Fields
Postdoctoral Researcher - Switzer Lab
Dept. of Biochemistry
University of Illinois Urbana-Champaign
More information about the Bioperl-l
mailing list