M
M
Mike Evstropov2016-01-16 16:52:12
Python
Mike Evstropov, 2016-01-16 16:52:12

What are extensible Python application architectures (OOP)?

What I was going for, here is the directory:

- - cgi-bin
- - | - - a.py
- - | - - a
- - | - - | - - __init__.py
- - | - - | - - b.py
- - | - - | - - b
- - | - - | - - | - - __init__.py
- - | - - | - - | - - c.py
- - | - - | - - | - - c
. . .

It would be convenient for me to access access to child classes in the same way as a property call.
That is, the class "a" in the file "a.py" -
class a:
  prop = 5

and in another package called "a", in file "b.py" class "b"
class b (a):
  prop = 7

after import, it would be convenient to refer to the class and its property like this:
a.prop
a.b.prop
# 5
# 7

Expandable? Yes.
But since the import looks for the package first, I can't load the "b" module.
If there is something more convenient and extensible, please provide an example.
And if my version has the right direction, then how to make it work?
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2016-01-16
@vintello

just crying! pearl :)

A
angru, 2016-01-18
@angru

some kind of fluff.
what will be imported, module a or package a? how does the interpreter know what you want from it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question