[Numpy-discussion] [SciPy-Dev] Good-bye, sort of (John Hunter)

josef.pktd@gmai... josef.pktd@gmai...
Sat Aug 14 15:47:15 CDT 2010


On Sat, Aug 14, 2010 at 4:02 PM, Joshua Holbrook
<josh.holbrook@gmail.com> wrote:
> On Fri, Aug 13, 2010 at 3:48 PM,  <josef.pktd@gmail.com> wrote:
>> On Fri, Aug 13, 2010 at 5:11 PM, Joshua Holbrook
>> <josh.holbrook@gmail.com> wrote:
>>>> Cause honestly, If I could dump everything in one file and be able to
>>>> use it everywhere.
>>>
>>> ...I could.
>>>
>>> Sorry.
>>
>> The main thing I was missing in matlab are namespaces, everything the
>> equivalent of
>> form numpy import *
>> form pylab import *
>> from scipy import *
>> from all_my_other_packages import *
>>
>> So, for a while I put many functions in one file and imported them as
>> function handles.
>>
>> I liked that I could edit a plot interactively and save as script.
>> This saved me a lot of time reading and figuring out the docs.
>> The new style classes in matlab look almost like python, but I haven't
>> worked with them yet.
>>
>> Josef
>>
>>
>>>
>>> --Josh
>>>
>>> On Fri, Aug 13, 2010 at 1:09 PM, Joshua Holbrook
>>> <josh.holbrook@gmail.com> wrote:
>>>> Yeah, I don't really like it either. Is there a good way to put
>>>> multiple global functions in a file without matlab getting upset?
>>>> Cause honestly, If I could dump everything in one file and be able to
>>>> use it everywhere.
>>>>
>>>> --Josh
>>>>
>>>> On Fri, Aug 13, 2010 at 12:59 PM, John Hunter <jdh2358@gmail.com> wrote:
>>>>> On Fri, Aug 13, 2010 at 3:41 PM, Benjamin Root <ben.root@ou.edu> wrote:
>>>>>> @Josh: Awesome name.  Very fitting...
>>>>>>
>>>>>> Another thing that I really love about matplotlib that drove me nuts in
>>>>>> Matlab was being unable to use multiple colormaps in the same figure.
>>>>>
>>>>> Funny -- this was one of the *first* things I thought about when
>>>>> writing mpl.  That limitation drove me nuts too.
>>>>>
>>>>> And while we're dissing matlab, the one-function-per-file development
>>>>> process that matlab seems to inspire (I did it too) is hard to fathom
>>>>> in retrospect.
>>>>>
>>>>> http://github.com/jesusabdullah/methlabs/blob/master/modules/extra/elemsof.m
>>>>>
>>>>> JDH
>>>>> _______________________________________________
>>>>> NumPy-Discussion mailing list
>>>>> NumPy-Discussion@scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>>
>>>>
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion@scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>
>> So, for a while I put many functions in one file and imported them as
> function handles.
>
> Ooh! How do you do that?

something like, api is a struct that has function handles and variables attached

    function api = setAPI

        api.fcn1 = @fcn1;
        api.fcn2 = @fcn2;
        api.showvar1 = @showvar1;
        api.getvar = @getvar;
        api.setglobalVar = @setglobalVar;
        api.getglobalVar = @getglobalVar;
        %api.globalVar = globalVar;

    end %setAPI

for the fun of it:
I attach one of my first matlab files to check out how the scope of
nested functions works, i.e. the workspace that is attached to
functions and nested functions. It's not very useful except for
learning matlab 2006. I don't find an example for sub functions
instead of nested functions right now.
And I soon gave up trying to program matlab like python.

Josef
(as off-topic as most of the second part of this thread)


>
> --Josh
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getnestedstruct.m
Type: application/x-matlab
Size: 2638 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100814/2c01a9ac/attachment.bin 


More information about the NumPy-Discussion mailing list