X-Received: by 10.66.146.136 with SMTP id tc8mr199667pab.43.1382252954173; Sun, 20 Oct 2013 00:09:14 -0700 (PDT) X-Received: by 10.50.82.33 with SMTP id f1mr119139igy.0.1382252954100; Sun, 20 Oct 2013 00:09:14 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!z6no55821081pbz.1!news-out.google.com!9ni50460qaf.0!nntp.google.com!o2no15211030qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.python Date: Sun, 20 Oct 2013 00:09:13 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.105.219.46; posting-account=WnQ31woAAAD53hPo6qPShawacgs0_foq NNTP-Posting-Host: 76.105.219.46 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: skipping __init__ and using exploiting a class member instead From: Peter Cacioppi Injection-Date: Sun, 20 Oct 2013 07:09:14 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.lang.python:57143 >The use of getattr here seems unfortunate Unfortunate how? It's a perfect for what I want here ... remember the conte= xt is such that the lazily stored value is always truthy (I assert this els= ewhere). > I'm not sure why you want to avoid an __init__ method. Why do you want to keep it? The more code you write the more bugs you writ= e. Who knows, maybe I screw up the argument pass to the super __init__. May= be I screw up the super reference. Didn't Einstein say make it as simple as= possible, but no simpler? Personally, I find the ability of Python to subclass without overriding the= constructor very elegant. I don't believe the other languages I've worked = in can do this (C++, C#, Java)... or if there is a way it's a bit scary and= discouraged. Whereas skipping the __init__ seems to be a standard part of = the Python OO development process. Again, this is just the lazy eval pattern. In C#, for example, I'd write my= constructors but refer to _lazy only in the foo function and in it's decla= ration line (which would explicitly default initialize it). At any rate, the second idiom is very pretty to me, I'm keeping it unless a= compelling argument is presented. Thanks for the kibbutzing though, the fi= rst idiom was poor form, as I suspected.