TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


Forums >


Re: Swapping Content of Two Dictionaries.

Stefan Behnel

3/17/2010 2:10:00 PM

Hatem Oraby, 17.03.2010 12:26:
> However, consider the case in which the dictionary we are referencing lives
> in another module:
> #external.py
> #
> #a = {1:"I'am A}
> import external
> temp = external.a
> external.a = b
> b = temp

Looks like the interface of your module is broken. It shouldn't export the
two dicts.

> My problem is that i need to do this operation a LOT, simply I got a problem
> that my program go through a very long loop and inside this loop this
> operation is needed to be done twice and the dictionary size ain't very
> small.

Please explain what you use the dicts for and how they are supposed to be
used by your own code and by external code. That will allow us to give an
advice on how to design your module better.