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


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

__init__ ?

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 __init__ ?
Date Thu, 2 Nov 2017 15:09:36 +0100
Lines 26
Message-ID <f60n90F4clsU1@mid.individual.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net udr+sfJcgGoPf9ZeZECzCgkKtihe+oAij35YNYSEpXGlU9qYUW
Cancel-Lock sha1:Vg6Xpp8Sh6sttD7PIE//PiAYrLY=
X-Mozilla-News-Host news://news.individual.de:119
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0
Content-Language de-DE
Xref csiph.com de.comp.lang.python:4996

Show key headers only | View raw


Bisher habe ich etwas wie

class Cl():
    def __init__(self):
       self.x=1

gemacht.
So wie das in Bücher üblich ist.

In einer raspberry pi Zeitschrift habe ich gesehen
dann man stattdessen auch

class Cl():
    x=1

schreiben kann.

Hat funktioniert.
( mit c=Cl(); print(c.x); c.x=2; print(c.x) )

Hermann
    fragend ob er jetzt viele __init__
    bedenkenlos ersetzen kann.

-- 
http://www.hermann-riemann.de

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


Thread

__init__ ? Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-11-02 15:09 +0100
  Re: [Python-de] __init__ ? Thomas Güttler <guettliml@thomas-guettler.de> - 2017-11-02 15:22 +0100
    Re: [Python-de] __init__ ? Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-11-02 15:51 +0100
  Re: [Python-de] __init__ ? "Diez B. Roggisch" <deets@web.de> - 2017-11-02 15:33 +0100
    Re: Python Beispiele SDL2? (was: __init__ ?) Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-11-02 17:28 +0100
      Re: [Python-de] Python Beispiele SDL2? (was: __init__ ?) "Diez B. Roggisch" <deets@web.de> - 2017-11-02 18:10 +0100
  Re: [Python-de] __init__ ? Stefan Behnel <python-de@behnel.de> - 2017-11-04 07:43 +0100
  Re: [Python-de] __init__ ? Dinu Gherman <gherman@darwin.in-berlin.de> - 2017-11-05 18:15 +0100
  Re: [Python-de] __init__ ? "Diez B. Roggisch" <deets@web.de> - 2017-11-05 22:09 +0100
  Re: [Python-de] __init__ ? Stefan Behnel <python-de@behnel.de> - 2017-11-06 20:57 +0100
    Re: [Python-de] __init__ ? Stefan Behnel <python-de@behnel.de> - 2017-11-06 21:28 +0100
      Re: [Python-de] __init__ ? "Peter J. Holzer" <hjp-usenet3@hjp.at> - 2017-11-06 22:29 +0100
        Re: [Python-de] __init__ ? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2017-11-07 11:11 +0000
        Re: [Python-de] __init__ ? Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-11-12 18:37 +0100
    Re: [Python-de] __init__ ? Hermann Riemann <nospam.ng@hermann-riemann.de> - 2017-11-12 19:22 +0100

csiph-web