Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #95247 > unrolled thread

Flan definition collision

Started bysmahabole@google.com
First post2015-08-10 23:28 -0700
Last post2015-08-11 13:29 +0200
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Flan definition collision smahabole@google.com - 2015-08-10 23:28 -0700
    Re: Flan definition collision Joel Goldstick <joel.goldstick@gmail.com> - 2015-08-11 06:31 -0400
    Re: Flan definition collision Luca Menegotto <otlucaDELETE@DELETEyahoo.it> - 2015-08-11 13:29 +0200

#95247 — Flan definition collision

Fromsmahabole@google.com
Date2015-08-10 23:28 -0700
SubjectFlan definition collision
Message-ID<238cfbd9-6ccb-4dcf-a4ea-3de78932db02@googlegroups.com>
I am importing two modules, each of which is defining flags (command line arguments) with the same name. This makes it impossible to import both the modules at once, because of flag name definition conflict. Is there any way which doesn't involve modifying the flag names in these modules?

[toc] | [next] | [standalone]


#95252

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2015-08-11 06:31 -0400
Message-ID<mailman.74.1439289114.3627.python-list@python.org>
In reply to#95247
On Tue, Aug 11, 2015 at 2:28 AM, smahabole--- via Python-list
<python-list@python.org> wrote:
> I am importing two modules, each of which is defining flags (command line arguments) with the same name. This makes it impossible to import both the modules at once, because of flag name definition conflict. Is there any way which doesn't involve modifying the flag names in these modules?

Please show relevant code.

  import a
  import b

will not cause a collision as a variable called v would be identified as

  a.v or b.v depending on where it is defined



-- 
Joel Goldstick
http://joelgoldstick.com

[toc] | [prev] | [next] | [standalone]


#95253

FromLuca Menegotto <otlucaDELETE@DELETEyahoo.it>
Date2015-08-11 13:29 +0200
Message-ID<mqcm9v$k84$2@speranza.aioe.org>
In reply to#95247
Il 11/08/2015 08:28, smahabole@google.com ha scritto:
> I am importing two modules, each of which is defining flags
 > (command line arguments) with the same name. This makes
 > it impossible to import both the modules at once, because of flag
 > name definition conflict.
>

If you use 'import', and not 'from xyz import', you avoid any conflict.

Ah: 'from ... import' has caused me a lot of terrible headaches. I don't 
use this statement if not strictly necessary.

-- 
Bye.
Luca

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web