Hello Chipy,<br><br>Does anyone know of a way to create property() members on an object programmatically?&nbsp; Anything I&#39;ve Googled with &quot;property&quot; and &quot;programmatically&quot; doesn&#39;t really come up with what I&#39;m looking for.<br>
<br>Here&#39;s my use case:<br><br>I&#39;m creating a ctypes wrapper for the LAME MP3 library.&nbsp; There are quite a few parameters that someone can set when encoding an MP3, such as the bitrate, number of audio channels, high pass frequency, blah, blah, blah.&nbsp; There&#39;s about 70.&nbsp; The issue is that there&#39;s 3 places in my wrapper where I have to declare them: once in the global LAME state object, once in setting up the argument types and return types of the LAME getter/setter functions, and once in my high level Python &quot;Encoder&quot; object.<br>
<br>So to make things easy and less error prone I declared a list of the parameters and their types so I could reuse the data I hand-typed in about these properties.&nbsp; I also have a small dictionary of overrides for parameters that aren&#39;t gettable or settable or that need to be handled with special circumstances.&nbsp; This worked fine for my first 2 places where I needed the data, but I&#39;m struggling to get it to work for the 3rd part, my high-level Encoder object.<br>
<br>I need to be able to create a property() on my Encoder object because setting a LAME parameter on an MP3 stream actually needs to call the LAME library, and if the return value&#39;s not good then I need to throw an exception. <br>
<br>The best I&#39;ve been able to do is use my data about the LAME parameters, output the Python code I need to a text file, and copy/paste that into my object&#39;s declaration.<br><br>Does anyone know how I could create a bunch of property() items on an object based on a list of data?<br>
<br>Thanks,<br><br>-Tim Gebhardt<br><a href="mailto:tim@gebhardtcomputing.com">tim@gebhardtcomputing.com</a><br>