[SciPy-dev] feedback on scipy.sparse
Fri Dec 14 06:21:58 CST 2007
Stefan van der Walt wrote:
> On Thu, Dec 13, 2007 at 01:17:22PM -0600, Nathan Bell wrote:
>>> Concerning the Stefan's idea of static methods for spidentity etc., we
>>> could use only one method for all of them, e.g.
>>> class spmatrix:
>>> def special( name, format = ... ):
>>> if name = 'identity':
>>> return spidentity(n,format=format)
>>> to prevent cluttering od the class you mentioned.
>> Good idea, I hadn't considered that option.
> If we do this, we are still merging functionality belonging in
> different classes together. Say we'd like to refactor lil_matrix into
> another package, for some reason. If we use "special", then
> extracting the functionality pertaining only to lil_matrix becomes a
> problem. I think functionality that requires insight into the
> entrails of an object belongs with that object.
> LilMatrix.special('eye',(3,4)) looks very verbose, compared to
> How many of these functions do we have? If we have in the order of 5
> to 10, then cluttering isn't really a problem.
Well, I like the second way more, too. 'special' has nothing special to
offer besides some clever hasattr/getattr magic to tell what functions
are available for a different kinds of matrices etc. I proposed this
only to address the potential cluttering problem, which is not present
if there are only several such functions.
More information about the Scipy-dev