Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78107
| 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 | <juan0christian@gmail.com> |
| 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 <juan0christian@gmail.com> |
| Date | Sat, 20 Sep 2014 10:44:45 -0300 |
| Subject | Class Inheritance from different module |
| To | Python <python-list@python.org> |
| 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 <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14170.1411220707.18130.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
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?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Class Inheritance from different module Juan Christian <juan0christian@gmail.com> - 2014-09-20 10:44 -0300 Re: Class Inheritance from different module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-09-21 00:31 +1000
csiph-web