Aug-25-2018, 11:50 AM
(This post was last modified: Aug-25-2018, 11:50 AM by NobahdiAtoll.)
(Aug-25-2018, 05:29 AM)Gribouillis Wrote: Yes. I'm also saying that if you write fromXml instead of self.fromXml, the code won't work.
Nice catch, saved me from having to hunt that down later
(Aug-25-2018, 05:29 AM)Gribouillis Wrote: Your code is valid, however, the best way to test if something is not None is if xmlElement is not None, otherwise if xmlElement is equivalent to if bool(xmlElement). It probably won't change anything in practice here, but if someone passes 0 or [] instead of nothing, it will be detected.
well this part of my code is internally controlled
xmlElement
will always equate to an xml.etree.ElementTree.Element
or None
since the user input will never have control over the creation of a movie(xmlElement)
or xmlProcessable(xmlElement)
or the xmlElement
parsed to create it, and i like to use as concise code as possible, there are other places where I do use is not None
but only when i need to test for other values individually as well.