Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #4752
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Hermann Riemann <nospam.ng@hermann-riemann.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] import Problem |
| Date | Fri, 28 Apr 2017 09:07:17 +0200 |
| Lines | 33 |
| 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> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net uiE7sVRides2iVTVK5ba9g4RV8mBSs4xEUxv2dkWCz5XuiPtJa |
| Cancel-Lock | sha1:+U5amEG0+whZyDfmPAh8zmsa3rw= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
| In-Reply-To | <mailman.476.1493362252.2951.python-de@python.org> |
| Xref | csiph.com de.comp.lang.python:4752 |
Show key headers only | View raw
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