[SciPy-dev] alternate .flags interface

Travis Oliphant oliphant at ee.byu.edu
Mon Oct 31 11:22:30 CST 2005


Fernando Perez wrote:

>Perry Greenfield wrote:
>  
>
>>I'm wondering if the current flags interface couldn't be made a bit 
>>easier to use to allow mapping of dictionary keys in to attributes. For 
>>example:
>>
>>instead of arr.flags["CONTIGUOUS"]
>>
>>arr.flags.contiguous
>>
>>If using a dictionary is considered useful (e.g., for getting the whole 
>>state, it is still possible to allow arr.flags to return a dictionary 
>>derived object that can be used wherever dictionaries are accepted, and 
>>likewise, assigning to arr.flags should be able to take a dictionary of 
>>flags. Any reason we can't support this interface?
>>    
>>
>
>Mmh.  What happens when you say
>
>arr.flags.update = 1
>
>and then pass arr.flags to a dict-expecting method which calls
>
>arr.flags.update(otherdict)
>  
>

I'm not sure I follow what the problem is. Is there an update flag?

First of all, arr.flags already returns a special dictionary (so that 
tests like Fortran but not contiguous are easy).

If you want to use attribute access to get and set the dictionary items, 
I don't see how that couldn't be done.

-Travis




More information about the Scipy-dev mailing list