Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43116

classes and sub classes?

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 <morten.guldager@gmail.com>
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 <morten.guldager@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.313.1365486619.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


[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 | NextNext in thread | Find similar | Unroll thread


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