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


Groups > de.comp.lang.python > #4755

Re: [Python-de] import Problem

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] import Problem
Date Fri, 28 Apr 2017 12:48:10 +0200
Organization None
Lines 20
Message-ID <mailman.481.1493376504.2951.python-de@python.org> (permalink)
References <emg3qcFkefeU1@mid.individual.net> <odurs8$ka2$1@blaine.gmane.org> <mailman.478.1493366431.2951.python-de@python.org> <emggijFmrvvU1@mid.individual.net> <odv6l8$sev$1@blaine.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding 8Bit
X-Trace news.uni-berlin.de k29vediz5c/v5NOmBJ1qYQqVsVqbu7+dgjcn5NGTCJhQ==
Return-Path <gcpgg-python-de@m.gmane.org>
X-Original-To python-de@python.org
Delivered-To python-de@mail.python.org
X-Injected-Via-Gmane http://gmane.org/
User-Agent KNode/4.13.3
X-BeenThere python-de@python.org
X-Mailman-Version 2.1.23
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 <odv6l8$sev$1@blaine.gmane.org>
X-Mailman-Original-References <emg3qcFkefeU1@mid.individual.net> <odurs8$ka2$1@blaine.gmane.org> <mailman.478.1493366431.2951.python-de@python.org> <emggijFmrvvU1@mid.individual.net>
Xref csiph.com de.comp.lang.python:4755

Show key headers only | View raw


Hermann Riemann wrote:

> ########## globale_funktionen.py
> import globale_variable
> g=globale_variable.variablen
> def f():
>     global g
>     g.x=1

Das "global"-Statement ist überflüssig, da du den Namen g nur liest.


> ########## globale_variable.py
> class Globale_Variablen:
>     def __init__(self):
>        self.x=0
> variablen=Globale_Variablen()

Wenn du sowieso mit Klassen hantierst, mach aus f() doch eine Methode.

Back to de.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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