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


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

__init__ ?

From Hermann Riemann <nospam.ng@hermann-riemann.de>
Newsgroups de.comp.lang.python
Subject __init__ ?
Date 2017-11-02 15:09 +0100
Message-ID <f60n90F4clsU1@mid.individual.net> (permalink)

Show all headers | 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