[PD-dev] Re: file library WAS: [folder_list]

Thomas Grill gr at grrrr.org
Mon Apr 3 00:37:41 CEST 2006


Hi Frank,

>> If we want a lot of functionality fast then python seems like the best
>> solution, coding the same thing in C will take longer (at least for 
>> me,
>> who does not even know python).
>
> Attached is a helluva lot of functionality as a Python script for
> pyext consisting of just 32 lines.
>

many thanks for that one.
As a reply, i wanted to demonstrate how your pyext script can be 
replaced by just using the new py (CVS) functionalities with internals, 
methods and object passing, but it's not as elegant as it should be. 
Some of it can be written as

[ symbol /tmp (
         -> 2nd inlet
[ py .str @py 1 ]   .... use internal str function and pass on Python 
object
         -> 2nd inlet
[ py os.listdir ]  .... os.listdir function
        -> 1st inlet
[ print OS ]


or


[ symbol ABC (
         -> 2nd inlet
[ py .str @py 1 ]   .... use internal str function and pass on Python 
object
         -> 2nd inlet
[ pym lower ]  .... apply lower method to Python object
        -> 1st inlet
[ print STRING ]

the weakness at the moment is that all PD symbols have to be explicitly 
converted into string objects, which is not very conventient 
(especially with symbols in lists). I'll add an attribute, so that this 
happens automatically, in order to enable easy usage of [ py 
string.replace ] etc.

best greetings,
Thomas










More information about the Pd-dev mailing list