Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mask superclass __init__
#6
(Jan-11-2018, 05:45 PM)fig0 Wrote: Can't I simple use the class __new__ magic method instead of creating a metaclass?
I don't think so. There is nothing magic in the __new__() method. Its role is to create a raw object prior to intialization. I wouldn't try to use __new__() to avoid calling the ancestor classes' constructor. It is not good design, and it will be difficult to handle several levels of inheritance.

Python provides metaclasses as the normal way to handle such specific type requests. What do you think is wrong with using a metaclass?
Reply


Messages In This Thread
Mask superclass __init__ - by fig0 - Jan-10-2018, 04:30 PM
RE: Mask superclass __init__ - by Gribouillis - Jan-10-2018, 05:19 PM
RE: Mask superclass __init__ - by fig0 - Jan-10-2018, 09:36 PM
RE: Mask superclass __init__ - by Gribouillis - Jan-10-2018, 09:46 PM
RE: Mask superclass __init__ - by fig0 - Jan-11-2018, 05:45 PM
RE: Mask superclass __init__ - by Gribouillis - Jan-11-2018, 06:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I mask Hex value wiht 0xFF? korenron 2 4,598 Nov-23-2021, 09:13 AM
Last Post: Gribouillis
  Using boolean mask in Numpy for 3D IlikePi 0 1,560 Nov-14-2020, 10:08 PM
Last Post: IlikePi
  superclass and super() grkiran2011 1 1,787 Jun-20-2020, 04:37 AM
Last Post: deanhystad
  Is it mandatory to call superclass init inside the class init? psolar 3 6,199 Feb-14-2020, 09:16 PM
Last Post: wavic
  Saving a mask as a png file in opencv DanTheMan 1 5,746 Jan-31-2020, 09:20 AM
Last Post: ThiefOfTime
  Subnet Mask Ranges ab52 0 1,850 Mar-11-2019, 10:39 AM
Last Post: ab52
  Create a List for Boolean Mask. leoahum 4 3,978 Oct-09-2018, 02:38 PM
Last Post: leoahum
  python script to get wildcard mask output in the following format techrichit 0 3,863 Aug-10-2018, 11:01 PM
Last Post: techrichit
  Why is there an __init__ statement within the __init__ definition iFunKtion 7 6,128 Feb-06-2017, 07:31 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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