473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

interface like behavior for mudules

Hello pyple,

I have two modules :remote.py and local.py which have some classes with
the same names specifically one we can call Model.So it exist
remote.Model class and local.Model class

A third module called uri.py derives some of its classes from a not
better specified repository.Model

at the beginning of uri.py I can write 'import local as repository' or
'import remote as repository'. In either cases the module uri is ready
to be imported from a fourth module

Now I have two applications ,say applocal.py and appremote.py. Both
import uri as a module ,but the first wants uri to have imported local
as repository and the second wants uri to have imported remote as
repository.

In pseudo language applocal.py would have 'import uri with local as
repository' at the beginning and appremote.py would have 'import uri
with remote as repository'

I wonder if there is a way to keep uri unique,because as it is now I
have to keep two modules,say urilocal and uriremote which differs only
for a line at the top.

I suppose __import__ is there to help me, but I have no idea on how.

Hope I have been clear,thanks for considerations and help

Yours Paolino

Jul 18 '05 #1
0 1022

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Simon Harvey | last post by:
Festive greetings fellow programmers! I've been programming now for about 4, maybe 5 years now. 4 of those years were at university so and I havent had much work experience of making real world...
3
by: Christof Warlich | last post by:
Hi, I'm looking for a more concise way than below to extend an existing interface. Just imagine that class Interface would have 1000 other members and class DerivedInterface only needs to add...
2
by: bingomanatee | last post by:
Is there any way to determine if a class is a member of an interface? For a concrete example: I am implementing a "node" (Node_if) interface on database record representing objects (children of the...
10
by: Brett | last post by:
I'm still trying to figure out concrete reasons to use one over the other. I understand the abstract class can have implementation in its methods and derived classes can only inherit one abstract...
6
by: John Salerno | last post by:
I understand how they work (basically), but I think maybe the examples I'm reading are too elementary to really show their value. Here's one from Programming C#: #region Using directives ...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
12
by: masoud bayan | last post by:
I've come across something in Interface implementation that I am not sure is correct behavior in VB.NET (and maybe C#) or not? Consider following example: Public Interface IShape
13
by: ^MisterJingo^ | last post by:
I've been reading up on interfaces, one example I came across showed that you can hide a method implemented from an interface from the class which implements it. To use it, you must cast to the...
20
by: Andy DeMaurice | last post by:
Something has changed from C# 1.0 to 2.0 regarding interface re-implementation. See my sample code below; when compiled and run under VS 2003, you get: Control.Paint Control.IControl.Paint ...
7
by: p_shakil | last post by:
Hi, I would like to know the interface concept in Python.How the Interface is defined and implemented in Python?. How to access the interface fromn Client? Thanks PSB
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.