Python Forum
initialisation and metaclass
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
initialisation and metaclass
#1
I try to write classes tied to a database.
I want to build properties with each fields of the database without writing all them by hand.
I'd think to do this with a metaclass that catches the fields in the database and create the associated properties by a descriptor.
But my metaclass need to access to the database. How can I pass the database connexion to the meta class before it is used to construct my class ?

Thank you.
Reply


Messages In This Thread
initialisation and metaclass - by GuiOhm - Mar-09-2020, 04:27 AM
RE: initialisation and metaclass - by Gribouillis - Mar-09-2020, 03:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  singleton using metaclass bb8 12 8,743 Feb-13-2018, 01:27 PM
Last Post: bb8

Forum Jump:

User Panel Messages

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