Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43116
| Date | 2013-04-09 07:50 +0200 |
|---|---|
| Subject | classes and sub classes? |
| From | Morten Guldager <morten.guldager@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.313.1365486619.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
'Aloha Friends!
I'm about to write an API against a huge propitiatory Oracle based network
inventory database. The database have many different concepts stored in
it's tables, can one concept can span over multiple tables.
I would like to write a class for accessing each concept, but only have a
single database connection throughout the whole program.
I imagine some code along these lines, but cant figure out how to declare
the classes that will make it work:
# create a connection to the database and perform come basic login and
initialization
nib = NwInvDb("scott/tiger@ora")
# find a device by ip
interesting_device = nib.Device.lookup_by_ip("192.168.1.1")
In this example I access the concept Device.
Should I make the Device class inherit from NwInvDb? Or should I keep them
separate? Later on I think I will even have to make some sort of
sub-concepts, but lets postpone that game until I really have really seen
the need!
--
/Morten %-)
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
classes and sub classes? Morten Guldager <morten.guldager@gmail.com> - 2013-04-09 07:50 +0200
Re: classes and sub classes? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-09 07:08 +0000
Re: classes and sub classes? Morten Guldager <morten.guldager@gmail.com> - 2013-04-09 09:38 +0200
Re: classes and sub classes? Jason Friedman <jsf80238@gmail.com> - 2013-04-14 19:38 -0600
Re: classes and sub classes? MRAB <python@mrabarnett.plus.com> - 2013-04-15 03:07 +0100
Re: classes and sub classes? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-14 22:35 -0400
Re: classes and sub classes? Peter Otten <__peter__@web.de> - 2013-04-15 09:21 +0200
Re: classes and sub classes? Neil Cerutti <neilc@norwich.edu> - 2013-04-15 12:22 +0000
csiph-web