Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
inheritence overrides
#6
(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.
Reply


Messages In This Thread
inheritence overrides - by NobahdiAtoll - Aug-24-2018, 06:27 PM
RE: inheritence overrides - by Gribouillis - Aug-24-2018, 09:14 PM
RE: inheritence overrides - by NobahdiAtoll - Aug-25-2018, 01:55 AM
RE: inheritence overrides - by volcano63 - Aug-24-2018, 09:30 PM
RE: inheritence overrides - by Gribouillis - Aug-25-2018, 05:29 AM
RE: inheritence overrides - by NobahdiAtoll - Aug-25-2018, 11:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  inheritence vs instanciation? hsunteik 1 3,067 Feb-18-2017, 10:40 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020