[Numpy-discussion] [OT: MATLAB] Any way to globally make Matlab struct attributes Python-property-like

David Goldsmith d.l.goldsmith at gmail.com
Sun Sep 19 02:56:28 EDT 2010


> Date: Tue, 14 Sep 2010 20:55:03 -0400
> From: Ken Watford <kwatford+scipy at gmail.com>
> Subject: Re: [Numpy-discussion] [OT: MATLAB] Any way to globally make
> 	Matlab struct attributes Python-property-like
> To: Discussion of Numerical Python <numpy-discussion at scipy.org>
> On Mon, Sep 13, 2010 at 10:24 PM, David Goldsmith
> <d.l.goldsmith at gmail.com> wrote:
>> I.e., I'd, at minimum, like to globally replace
>>
>> get(Handel, 'Property')
>>
>> with
>>
>> object.Property
>>
>> and
>>
>> set(Handel, 'Property', value)
>>
>> with
>>
>> object.Property = value
>>
>> to an arbitrary level of composition.
>
> Both structures and objects of both handle and value types work
> exactly like you're asking for.
>
> You're probably talking about "handle graphics" objects (which are
> just opaque numeric values representing things related to the UI),
> which do still require the get/set functions.

Yes, my mistake, sorry (I figured out the distinction a day or two
after I posted).

>  They're just doubles,
> after all. It should be feasible to write a class that wraps them for
> ease of use, but that wouldn't be a topic for here. If that intrigues
> you, try asking about it on StackOverflow.

Of course, I'll go there if/when need be, thanks!  (For now, I've
managed to weasel my way into using Python for my next
assignment--yippee!)

DG
-- 
In science it often happens that scientists say, 'You know that's a really
good argument; my position is mistaken,' and then they would actually change
their minds and you never hear that old view from them again. They really do
it. It doesn't happen as often as it should, because scientists are human
and change is sometimes painful. But it happens every day. I cannot recall
the last time something like that happened in politics or religion.

- Carl Sagan, 1987 CSICOP address



More information about the NumPy-Discussion mailing list