Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5397
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Achim Herwig <python@wodca.de> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] import Problem |
| Date | Fri, 11 Jan 2019 11:28:31 +0100 |
| Lines | 85 |
| Message-ID | <mailman.194.1547202519.4816.python-de@python.org> (permalink) |
| References | <g9r8r8Ffq9nU1@mid.individual.net> <ED4FA3F9-31C6-4025-BB09-F1FF7E8E7736@wodca.de> |
| Mime-Version | 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de GE3/bre3I0vsxSGmUxUejwehWBjQDNoEAUoABiI1yHgg== |
| Return-Path | <python@wodca.de> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| In-Reply-To | <g9r8r8Ffq9nU1@mid.individual.net> |
| X-Mailer | Apple Mail (2.3445.102.3) |
| X-Content-Filtered-By | Mailman/MimeDel 2.1.29 |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.29 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <ED4FA3F9-31C6-4025-BB09-F1FF7E8E7736@wodca.de> |
| X-Mailman-Original-References | <g9r8r8Ffq9nU1@mid.individual.net> |
| Xref | csiph.com de.comp.lang.python:5397 |
Show key headers only | View raw
> Am 11.01.2019 um 11:18 schrieb Hermann Riemann <nospam.ng@hermann-riemann.de>:
>
> Gegeben große Datei mit
>
> z=6
>
> def a():
> global z
> # viel code
> print("in a")
> z-=1
> if z>0: b()
> # viel code
>
> def b():
> global z
> # viel code
> print("in b")
> a()
> # viel code
>
> Die soll zerlegt werden in
> ma.py:
>
# fehlt:
from mb import *
> z=6
>
> def a():
> global z
> # viel code
> print("in a")
> z-=1
> if z>0: b()
> # viel code
>
> mb.py:
>
# fehlt:
from ma import *
> def b():
> global z
> # viel code
> print("in b")
> a()
> # viel code
>
> Der Aufruf von
>
> from ma import *
> from mb import *
>
> a()
>
> liefert:
> Traceback (most recent call last):
> File "mm.py", line 4, in <module>
> a()
> File "/y/g/py.modul/ma.py", line 8, in a
> if z>0: b()
> NameError: name 'b' is not defined
>
> Hermann
> der gerne große Dateien mit Python3
> Programmen zerlegen würde,
> ohne obiges Problem zu haben,
> oder es mit Tricks wie indirekter Programmaufruf
> zu umgehen.
und dazu mal https://docs.python.org/3/tutorial/modules.html <https://docs.python.org/3/tutorial/modules.html> lesen könnte...
VG, Achim.
--
Achim Herwig <python@wodca.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> - 2019-01-11 11:18 +0100
Re: [Python-de] import Problem Achim Herwig <python@wodca.de> - 2019-01-11 11:28 +0100
Re: [Python-de] import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-01-11 15:42 +0100
Re: [Python-de] import Problem Peter Otten <__peter__@web.de> - 2019-01-11 15:33 +0100
Re: [Python-de] import Problem Hermann Riemann <nospam.ng@hermann-riemann.de> - 2019-01-11 17:09 +0100
csiph-web