Class Inheritance from different module

Juan Christian juan0christian at gmail.com
Sat Sep 20 09:44:45 EDT 2014


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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140920/8096b184/attachment.html>


More information about the Python-list mailing list