Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12619
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'constructor': 0.07; 'names.': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'programmer': 0.10; 'def': 0.15; 'class,': 0.15; 'bieber': 0.16; 'code?': 0.16; 'constructed': 0.16; 'convention"': 0.16; 'declaimed': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'mangled': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'received:mindspring.com': 0.16; 'received:wlfraed': 0.16; 'risk,': 0.16; 'subject:PROBLEM': 0.16; 'things...': 0.16; 'underscore': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'say,': 0.19; 'url:home': 0.21; 'sep': 0.23; 'besides': 0.24; 'says': 0.25; 'hey': 0.26; 'fact': 0.27; 'lee': 0.28; 'thu,': 0.28; 'problem': 0.28; 'convention': 0.29; 'explicitly': 0.29; 'class': 0.30; 'does': 0.32; 'there': 0.33; 'to:addr:python-list': 0.33; 'difference': 0.34; 'latter': 0.34; 'which,': 0.34; 'header:X-Complaints-To:1': 0.35; 'supposed': 0.35; 'object': 0.35; 'charset:us-ascii': 0.36; 'beginning': 0.36; 'doing': 0.36; 'skip:" 10': 0.36; 'none': 0.37; 'something': 0.37; 'could': 0.38; 'think': 0.38; 'received:org': 0.38; 'subject:: ': 0.39; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'your': 0.61; 'double': 0.61; 'special': 0.67; 'subject:!': 0.67; 'supply': 0.69; 'dennis': 0.77 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Constructors...BIIIIG PROBLEM! |
| Date | Thu, 01 Sep 2011 22:19:20 -0700 |
| Organization | > Bestiaria Support Staff < |
| References | <CABWGKeW6sw2GJghQRbPcUA7_EO2V7SX5iJH0Pz0u513wX9TPNw@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | user-11fb66t.dsl.mindspring.com |
| X-Newsreader | Forte Agent 3.3/32.846 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.689.1314941709.27778.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1314941709 news.xs4all.nl 2451 [2001:888:2000:d::a6]:38733 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12619 |
Show key headers only | View raw
On Thu, 1 Sep 2011 13:18:52 +0530, Amogh M S <msamogh@gmail.com>
declaimed the following in gmane.comp.python.general:
> 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):
> 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?
Besides the fact that the "constructor" is __new__(), and __init__()
is an initializer of the constructed object (rarely does one really need
to supply __new__() )... there is a difference from __init__() and
_init_()... The latter is just a "use at your own risk, none public
convention" name.
Double underscore at beginning and end are Python special names.
Double underscore at beginning is a Python mangled name. Single
underscore at beginning is a programmer convention for "internal use
only".
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Constructors...BIIIIG PROBLEM! Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-09-01 22:19 -0700
csiph-web