Jean-Michel Pichavant wrote:

What is worrying me the most in your code sample is that self.cmd can hold diferrent types (str, and something else). That is usually a bad thing to do (putting None aside). However, my remark could be totally irrelevant of course, that depends on the context.

That's a valid criticism - but I do not know how to handle this otherwise really, because the program can be called with "cmd" to run, or a script to run (or a directory to copy) and in those cases cmd is None.

I guess I could use

if cmd:
        self.cmd = ...


But. Suppose that under some circumstances cmd is not string. What then?

I know that isinstance is typically not recommended, but I don't see better solution here.


Regards,
mk


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to