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


Groups > comp.lang.python > #12551 > unrolled thread

Re: Constructors...BIIIIG PROBLEM!

Started byPeter Otten <__peter__@web.de>
First post2011-09-01 09:56 +0200
Last post2011-09-01 09:56 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Constructors...BIIIIG PROBLEM! Peter Otten <__peter__@web.de> - 2011-09-01 09:56 +0200

#12551 — Re: Constructors...BIIIIG PROBLEM!

FromPeter Otten <__peter__@web.de>
Date2011-09-01 09:56 +0200
SubjectRe: Constructors...BIIIIG PROBLEM!
Message-ID<mailman.649.1314863755.27778.python-list@python.org>
Amogh M S wrote:

> Hey guys...
> I think we have a problem with my _init_ method and the constructor
> When I create a class and its _init_ method and try to create an object of
> it outside the class,
> Say, something like
> 
> class S:
>    def _init_(self, name=None):

Your __init__() method needs two leading and two trailing underscores.

>        self.name = name
> s = S("MyName")
> 
> It says that the constructor takes no arguments!! I have to explicitly
> call the _init_ method which, I think is not the right way of doing
> things... Could you tell me if that is what is supposed to happen or is
> something wrong with my code?

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web