Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4752
| From | Hermann Riemann <nospam.ng@hermann-riemann.de> |
|---|---|
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] import Problem |
| Date | 2017-04-28 09:07 +0200 |
| Message-ID | <emg816Fl701U1@mid.individual.net> (permalink) |
| References | <emg3qcFkefeU1@mid.individual.net> <EEA74591-90FD-455F-8485-5075B3B25360@chrisarndt.de> <mailman.476.1493362252.2951.python-de@python.org> |
Am 28.04.2017 um 08:45 schrieb Christopher Arndt:
>> Am 28.04.2017 um 07:55 schrieb Hermann Riemann <nospam.ng@hermann-riemann.de>:
>> python3 p5.py
>> liefert leider 0
>
> Zum Glück tut es das, denn py3.x und p4.x sind unterschiedliche Variablen. In Python sind mit "global" deklarierte Variablen *modul*global, d.h. Jedes Modul hat seinen eigenen Namensraum.
>
> https://docs.python.org/3/tutorial/classes.html#python-scopes-and-namespaces
Damit ist mein Problem nicht gelöst.
Ein Einfügen als erste Zeile in p4.py von
from p3 import *
bewirkt keine Änderung im Ergebnis.
Erst eine Änderung von von p4.y auf
import p3
def f():
p3.x=1
wirkt
Hermann
der die Folgen von
import p3
in p4.py
gleichzeitig mit
import p4
in p3.py
nicht so recht überblickt.
--
http://www.hermann-riemann.de
Back to de.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-04-28 07:55 +0200
Re: [Python-de] import Problem Christopher Arndt <chris@chrisarndt.de> - 2017-04-28 08:45 +0200
Re: [Python-de] import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-04-28 09:07 +0200
Re: [Python-de] import Problem Peter Otten <__peter__@web.de> - 2017-04-28 09:44 +0200
Re: [Python-de] import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-04-28 11:33 +0200
Re: [Python-de] import Problem Peter Otten <__peter__@web.de> - 2017-04-28 12:48 +0200
Re: [Python-de] import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-04-28 13:21 +0200
Re: [Python-de] import Problem Peter Otten <__peter__@web.de> - 2017-04-28 14:48 +0200
Re: import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-04-28 14:48 +0200
csiph-web