Introspection Question: Determining subclass name in base class

S

Stephen Nesbitt

All:

Here's my implementation problem. I have a base class which has the
responsibility for providing entry into the logging system. Part of
the class responsibility is to ensure that lagger names are
consistent. For all intents and purposes this class should be
considered abstract and will always be subclassed.

What I want to do is the following:
- allow the logger name to set explicitly. I've accomplished this by
adding a loggerName parameter to __init__ in the base class.
- if the loggerName variable is None, then set it to the name of the
subclass for which we are initing.

There seem to be two issues here.
1) determining the subclass name inside the _init__method in the
abstract base class. All my efforts so far have resulted in the
name of the base class rather than the calling subclass.

2) setting the default of a parameter to a function.

Can anyone help?

Thanks!

-steve
--

Stephen Nesbitt
Senior Configuration Management Engineer
The Cobalt Group
206.219.8271
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top