Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.061 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'lines,': 0.07; 'postpone': 0.07; 'span': 0.09; 'api': 0.11; 'stored': 0.12; 'subject:sub': 0.16; 'tables,': 0.16; 'later': 0.20; 'example': 0.22; 'lets': 0.24; 'login': 0.25; 'sort': 0.25; 'message-id:@mail.gmail.com': 0.30; 'along': 0.30; "i'm": 0.30; 'code': 0.31; 'work:': 0.31; 'class': 0.32; 'figure': 0.32; 'device': 0.34; 'basic': 0.35; 'classes': 0.35; 'connection': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'accessing': 0.36; 'oracle': 0.36; 'subject:?': 0.36; 'should': 0.36; 'throughout': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'how': 0.40; 'even': 0.60; 'skip:n 30': 0.60; 'different': 0.65; 'skip:n 40': 0.81; 'program.\xa0': 0.84; 'device.': 0.93; 'imagine': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=+GqDQB1XnJ+c4Fie/wMe5DrtBlPLqpS8eP2xpJsXfkI=; b=iYoN/MAFlOQUMgJ8x03f6wD0njTpSgOHoqEPXTFrwrpIAP9E+2XyiQ8kBv6H+NOExT ZKyrSDeQoPd0Krvt6fivVxsUBMJbLNDK+UYWBHzXNs2BzIvLV1dWHaAYKVpisV+ZNNp8 c5VLOFcpxtl1chgZ4yph2sO9ks/OE/iUBO8l07LcRQWOmMp9ostBAm3LHBLpfgjPDJwE UmztPQNGARQt42McNv19TpjEY+Oww9a3z030L9GNcz/7beXaRo2Jo9lp2fqUw+Fv3JL8 HFeWm1TfEET/DvQysnGVoHM0K8Z4WTaqfQl7OD1CHfVhYITxPyMcTR6+wzPyqbS7UMZV hdng== MIME-Version: 1.0 X-Received: by 10.152.43.131 with SMTP id w3mr1279071lal.29.1365486611599; Mon, 08 Apr 2013 22:50:11 -0700 (PDT) Date: Tue, 9 Apr 2013 07:50:11 +0200 Subject: classes and sub classes? From: Morten Guldager To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c272746e18a904d9e72011 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 58 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365486619 news.xs4all.nl 6856 [2001:888:2000:d::a6]:38859 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43116 --001a11c272746e18a904d9e72011 Content-Type: text/plain; charset=ISO-8859-1 '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 %-) --001a11c272746e18a904d9e72011 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 'Aloha Friends!

I'm about to write an API=A0agai= nst a huge=A0propitiatory Oracle based network inventory database. The data= base have many different concepts stored in it's tables, can one concep= t can span over multiple tables.

I would like to write a class for accessing each concep= t, but only have a single database connection throughout the whole program.= =A0

I imagine some code along these li= nes, 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 =3D NwInvDb("scott/tiger@= ora")
# find a device by ip
interesting_device =3D= 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 shou= ld I keep them separate? Later on I think I will even have to make some sor= t of sub-concepts, but lets=A0postpone=A0that game until I really have real= ly seen the need!


--
/Morten %-)=20
--001a11c272746e18a904d9e72011--