Re: Single DB connection during class's lifetime. Metaclass,singleton and __new__() examples and references.

2018-10-13 Thread Cameron Simpson
On 12Oct2018 13:28, Ryan Johnson wrote: Thanks for the clarification. If I am creating a class variable, are you suggesting I perform the “if it exists, great, otherwise make it” logic in the __init__ block or in the class definition block? Will that even run in a class definition? The clas

RE: Single DB connection during class's lifetime. Metaclass,singleton and __new__() examples and references.

2018-10-12 Thread Ryan Johnson
AM To: python-list@python.org Subject: Re: Single DB connection during class's lifetime. Metaclass,singleton and __new__() examples and references. On 12/10/2018 01:19, Ryan Johnson wrote: > I am working on using mysql.connector in a class and have found an example of > how to crea

Re: Single DB connection during class's lifetime. Metaclass, singleton and __new__() examples and references.

2018-10-12 Thread Thomas Jollans
On 12/10/2018 01:19, Ryan Johnson wrote: I am working on using mysql.connector in a class and have found an example of how to create a single connection that spans the lifetime of all instances of the class: https://softwareengineering.stackexchange.com/a/358061/317228 however, I do not under

Re: Single DB connection during class's lifetime. Metaclass, singleton and __new__() examples and references.

2018-10-12 Thread dieter
Ryan Johnson writes: > I am working on using mysql.connector in a class and have found an example of > how to create a single connection that spans the lifetime of all instances of > the class: > > https://softwareengineering.stackexchange.com/a/358061/317228 > > however, I do not understand a

Single DB connection during class's lifetime. Metaclass, singleton and __new__() examples and references.

2018-10-11 Thread Ryan Johnson
I am working on using mysql.connector in a class and have found an example of how to create a single connection that spans the lifetime of all instances of the class: https://softwareengineering.stackexchange.com/a/358061/317228 however, I do not understand a few things about the class, includ