473,385 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Introspection Question: Determining subclass name in base class

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
sn******@cobaltgroup.com
Jul 18 '05 #1
0 1222

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mark English | last post by:
I'd like to write a Tkinter app which, given a class, pops up a window(s) with fields for each "attribute" of that class. The user could enter values for the attributes and on closing the window...
0
by: Steven T. Hatton | last post by:
I suspect the core language is not the level at which introspection should be implemented in C++. That has been the choice of C#, and Java. Both of these languages made some trade-offs to...
26
by: Michael A. Covington | last post by:
Suppose class X has some public properties, and class Y inherits from X. Is there a way that some of the public properties of X can be private (hidden) in Y (but still usable by the methods...
0
by: Kirk McDonald | last post by:
Me again! Same project as before, if you're playing along at home. The Everything Engine model (which I am blatantly copying in my project) is that everything in the engine is a 'node,' and that...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.