<div dir="ltr">Yes, but imagine ProcessB is a subclass of ProcessA, and ProcessA's inputs include LiteralInput instances. Then, ProcessB's inputs refer to the same instances as ProcessA, which seems risky. In my mind, ProcessB should instantiate its own LiteralInput instances, but I haven't found a way yet to do this that doesn't feel clunky and unpythonic. <div><br></div><div>To clarify: </div><div><br></div><div>class ProcessA:</div><div>    in1 = LiteralInput(...)</div><div><br></div><div>    def __init__(...):</div><div>        ...</div><div>        inputs=[self.in1,...]</div><div><br></div><div><br></div><div>class ProcessB:</div><div>    in2 = LiteralInput()</div><div><br></div><div>        def __init__(...):</div><div>            ...</div><div>            inputs=[self.in1, self.in2, ...]</div><div><br></div><div>I suppose one option is to deep copy the input instances: </div><div><br></div><div>inputs=[self.in1.clone(), self.in2.clone(), ...]</div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Apr 16, 2018 at 1:06 PM Luí­s Moreira de Sousa <<a href="mailto:luis.de.sousa@protonmail.ch" target="_blank">luis.de.sousa@protonmail.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi again David,<br></div><div><br></div><div>that is the quark, strangeness and charm of Python, class properties are simultaneously static and instance properties. If you are not aware of this, then yes, you might risk "misreferencing" properties. This usually happens when you invoke an instance property that has not yet been modified/assigned. I do not find think this to be a major problem, as long as you always access properties through the instances.<br></div><div><br></div><div>Cheers.</div><div class="m_-3093730605582356719m_8663093964835694296protonmail_signature_block"><div class="m_-3093730605582356719m_8663093964835694296protonmail_signature_block-user"><div><br></div><div>-- <br></div><div>Luís Moreira de Sousa<br></div><div><a href="https://maps.google.com/?q=Bowlespark+8+6701+DN+Wageningen+The+Netherlands&entry=gmail&source=g" target="_blank">Bowlespark 8</a><br></div><div><a href="https://maps.google.com/?q=Bowlespark+8+6701+DN+Wageningen+The+Netherlands&entry=gmail&source=g" target="_blank">6701 DN Wageningen</a><br></div><div><a href="https://maps.google.com/?q=Bowlespark+8+6701+DN+Wageningen+The+Netherlands&entry=gmail&source=g" target="_blank">The Netherlands</a><br></div><div>Phone: +31 628 544 755<br></div><div>Email: <a href="mailto:luis.de.sousa@protonmail.ch" target="_blank">luis.de.sousa@protonmail.ch</a><br></div><div>RingID: ring:7ca91d83f4f9dec82fec9f1144b8e5c1ef2a110c<br></div><div>URL: <a href="https://ldesousa.github.io" target="_blank">https://ldesousa.github.io</a><br></div></div><div><br></div><div class="m_-3093730605582356719m_8663093964835694296protonmail_signature_block-proton">Sent with <a href="https://protonmail.com" target="_blank">ProtonMail</a> Secure Email.<br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On April 16, 2018 3:40 PM, David Huard <<a href="mailto:huard.david@ouranos.ca" target="_blank">huard.david@ouranos.ca</a>> wrote:<br></div><div> <br></div><blockquote type="cite" class="m_-3093730605582356719m_8663093964835694296protonmail_quote"><div dir="ltr"><div>Hi Luis, <br></div><div><br></div><div>Isn't there a risk for different Process instances to share the same Input instances ? It seems to me that that could lead to weird behavior. <br></div><div><br></div><div>Cheers, <br></div><div><div><br></div><div>David<br></div></div></div><div><br></div><div class="gmail_quote"><div dir="ltr">On Sat, Apr 14, 2018 at 2:18 PM Luí­s Moreira de Sousa <<a href="mailto:luis.de.sousa@protonmail.ch" target="_blank">luis.de.sousa@protonmail.ch</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi David,<br></div><div><br></div><div>I have done this in the past, pretty much as you say, by promoting the inputs and outputs objects to class properties. Other elements like title, abstract, etc, can be treated in the same way. This would all go into an "abstract" class from which actual process inherited. Perhaps there might be more elegant solutions, but to me this setting served well (I am a man of simple tastes).<br></div><div><br></div><div>All that said, it could make sense defining inputs, outputs, etc as class properties in the Process class itself. Something to think about.<br></div><div><br></div><div>Happy coding. Cheers.<br></div><div><br></div><div class="m_-3093730605582356719m_8663093964835694296m_-2203781666092854549protonmail_signature_block"><div class="m_-3093730605582356719m_8663093964835694296m_-2203781666092854549protonmail_signature_block-user"><div>-- <br></div><div>Luís Moreira de Sousa<br></div><div><a href="https://maps.google.com/?q=Bowlespark+8+6701+DN+Wageningen+The+Netherlands&entry=gmail&source=g" target="_blank">Bowlespark 8</a><br></div><div><a href="https://maps.google.com/?q=Bowlespark+8+6701+DN+Wageningen+The+Netherlands&entry=gmail&source=g" target="_blank">6701 DN Wageningen</a><br></div><div><a href="https://maps.google.com/?q=Bowlespark+8+6701+DN+Wageningen+The+Netherlands&entry=gmail&source=g" target="_blank">The Netherlands</a><br></div><div>Phone: +31 628 544 755<br></div><div>Email: <a href="mailto:luis.de.sousa@protonmail.ch" target="_blank">luis.de.sousa@protonmail.ch</a><br></div><div>RingID: ring:7ca91d83f4f9dec82fec9f1144b8e5c1ef2a110c<br></div><div>URL: <a href="https://ldesousa.github.io" target="_blank">https://ldesousa.github.io</a><br></div></div><div><br></div><div class="m_-3093730605582356719m_8663093964835694296m_-2203781666092854549protonmail_signature_block-proton">Sent with <a href="https://protonmail.com" target="_blank">ProtonMail</a> Secure Email.<br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div>On April 11, 2018 11:51 PM, David Huard <<a href="mailto:huard.david@ouranos.ca" target="_blank">huard.david@ouranos.ca</a>> wrote:<br></div><div><br></div><blockquote type="cite" class="m_-3093730605582356719m_8663093964835694296m_-2203781666092854549protonmail_quote"><div dir="ltr"><div>Hi all, <br></div><div><br></div><div>I often find myself in situations where it would be useful to subclass a Process and avoid copy-pasting shared inputs and outputs. The way most processes are written does not lend itself well to this, inputs being instance objects rather than class objects. I was wondering if any of you had experience with an elegant way to subclass pywps processes that is readable and does not pollute the class namespace too much. <br></div><div><br></div><div>Thanks, <br></div><div><br></div><div>david<br></div></div></blockquote><div><br></div><div>_______________________________________________<br></div><div> pywps-dev mailing list<br></div><div> <a href="mailto:pywps-dev@lists.osgeo.org" target="_blank">pywps-dev@lists.osgeo.org</a><br></div><div> <a href="https://lists.osgeo.org/mailman/listinfo/pywps-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/pywps-dev</a><br></div></blockquote></div></blockquote><div><br></div></blockquote></div></div>