Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'third-party': 0.04; 'subject:module': 0.09; 'api': 0.11; 'def': 0.12; 'creates': 0.14; 'api,': 0.16; 'inheritance': 0.16; 'key)': 0.16; 'possible?': 0.16; 'module': 0.19; 'not,': 0.20; 'code,': 0.22; 'import': 0.22; 'finally,': 0.24; 'this:': 0.26; 'installed': 0.27; 'message- id:@mail.gmail.com': 0.30; 'code': 0.31; "skip:' 10": 0.31; '"': 0.31; 'way?': 0.31; 'class': 0.32; 'skip:_ 10': 0.34; 'subject:from': 0.34; 'skip:s 30': 0.35; 'skip:u 20': 0.35; 'received:google.com': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'skip:a 30': 0.61; 'new': 0.61; 'user,': 0.69; 'subject:Class': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=0ZhuNkB5PAl70YUXJxlRk4XbZ5sgniNEPGxeLptx1NI=; b=oFcOz34NbJ0pMBudFoBZt9KvfOWpml14oS6O+XKWHJwDnzw1ErYvTHQt4XhRfoK2B+ ehbHB8kjGBQ+kOxfOb2RKKCvPs0/Qx1DkgPWRzgZtiONXoNeNdgdZW6nvMLAjo8GeeZT 1rCJByxo54cjdNOUhZC3s8x3JurdMIMYYnATGLhj2RpexOrEQJ3fd8D1gNBRSq84Q6Xz Hzv6x/yJ2ggEt99gEcXZXI7zyt8dIQ4ZdpN9JTOvl9wNMVc9E74Y3YSlcslCgjsEDzbD cX9uysojRk7khkofnLUKK4O5sOZgWFrONd3ftheIzzBJj2zdrrOLiX6mS52vTF8aJFTF CN1g== X-Received: by 10.152.20.1 with SMTP id j1mr13173773lae.57.1411220705121; Sat, 20 Sep 2014 06:45:05 -0700 (PDT) MIME-Version: 1.0 From: Juan Christian Date: Sat, 20 Sep 2014 10:44:45 -0300 Subject: Class Inheritance from different module To: Python Content-Type: multipart/alternative; boundary=089e013d1d4cd419c305037f6cfd 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: 64 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411220707 news.xs4all.nl 2840 [2001:888:2000:d::a6]:41767 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78107 --089e013d1d4cd419c305037f6cfd Content-Type: text/plain; charset=UTF-8 I have the following structure: Third-party API installed via pip: steamapi / app.py consts.py core.py users.py [...] My script: test.py In the API, the module users.py has a class 'SteamUser' and I want to mimic it's usage on my code, like this: import steamapi [...] class User(Inheritance from API): def __init__(self, ID): steamapi.core.APIConnection(api_key = KEY) super( " Inheritance SteamUser" (ID)) # creates the user using the API [...] So that in my code when I need to create a new user, I just call 'usr = User("XXXXXXX")' instead of calling 'usr = steamapi.user.SteamUser(76561197996416028)', is that possible? And of course, I want to have access to all the class methods like 'name', 'country_code', 'time_created', 'avatar', 'friends' and so on. And finally, is that a good approach, pythonic? If not, what would be a good way? --089e013d1d4cd419c305037f6cfd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I have the following structure:

Third-p= arty API installed via pip:
steamapi /
app.py
=
consts.py
core.py
users.py
[...]

My script:
test.py


In the API, the module users.py has a class 'SteamUser&= #39; and I want to mimic it's usage on my code, like this:
import steamapi

[...]
<= br>
class User(Inheritance from API):
def __init__(self, ID):
<= span class=3D"" style=3D"white-space:pre"> steamapi.core.APIConnect= ion(api_key =3D KEY)
= super( " Inheritance SteamUser" (ID)) # creates the user = using the API

[...]

So that in my code when I need to create a new user, I just call 'usr = =3D User("XXXXXXX")' instead of calling 'usr =3D steamapi= .user.SteamUser(76561197996416028)', is that possible? And of course, I= want to have access to all the class methods like 'name', 'cou= ntry_code', 'time_created', 'avatar', 'friends'= and so on. And finally, is that a good approach, pythonic? If not, what wo= uld be a good way? --089e013d1d4cd419c305037f6cfd--