Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: 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; 'argument': 0.04; 'completeness': 0.07; 'definitions': 0.07; 'python': 0.09; 'abstain': 0.09; 'overwrite': 0.09; 'received:155': 0.09; 'sep': 0.09; 'def': 0.10; '(the': 0.15; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'instances,': 0.16; 'naming': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:169.70': 0.16; 'received:bankone.net': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'received:svr.bankone.net': 0.16; 'securities,': 0.16; 'subject:class': 0.16; 'subject:variable': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'variable': 0.20; 'holds': 0.20; 'to:name:python- list@python.org': 0.20; 'received:169.254': 0.24; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'accuracy': 0.27; '+0100,': 0.29; 'question:': 0.29; 'definition': 0.29; 'received:169': 0.29; 'class': 0.29; 'header:Received:8': 0.30; 'print': 0.32; 'to:addr:python-list': 0.33; 'recommended': 0.33; 'list': 0.35; 'subject:': 0.36; 'email addr:python.org': 0.36; 'charset:us-ascii': 0.36; 'sent:': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'email name:python-list': 0.62; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; 'subject': 0.66; 'purchase': 0.67; 'sale': 0.76; 'received:169.254.8': 0.84; 'dennis': 0.91 X-DKIM: OpenDKIM Filter v2.1.3 sf3.jpmchase.com q8RHKGHk025887 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1348766416; bh=4Am+WnSYDLBsDhSPCcFNNWNnFTgyL+4Rt2GDNzkqTsI=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=VF+qPQDVJ2rwBoBVu24RU92pd8THQ54Ex5weHdaAkwy0NtJo0ovbeG2M31ldmyTch qpY4JIyMJtLSuEy0ELiyk+XBWjBIlH/AImAFrC0eRrH88q5RhtwWojzHuSho1hH8/K yxgbvQ+vknJ3/5V8OdUL0Nkp98aeQ3+IsWdTxL8E= From: "Prasad, Ramit" To: "python-list@python.org" Subject: RE: Capitalization for variable that holds a class Thread-Topic: Capitalization for variable that holds a class Thread-Index: AQHNmaRvp5xSsdSZoECfQhuW6u4xN5eYKHVZgAZLbpA= Date: Thu, 27 Sep 2012 17:20:03 +0000 References: <5efu58paorg84u94l9ca1ibh7901dcjugm@invalid.netcom.com> In-Reply-To: <5efu58paorg84u94l9ca1ibh7901dcjugm@invalid.netcom.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.67.79.47] Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DLP-FWD: Yes Content-Type: text/plain; charset="us-ascii" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348767726 news.xs4all.nl 6952 [2001:888:2000:d::a6]:33672 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30316 Dennis Lee Bieber wrote:=0D=0A> Sent: Sunday, September 23, 2012 11:53 AM= =0D=0A> To: python-list@python=2Eorg=0D=0A> Subject: Re: Capitalization for= variable that holds a class=0D=0A> =0D=0A> On Sun, 23 Sep 2012 16:48:38 +0= 100, Joshua Landau=0D=0A> declaimed the = following in=0D=0A> gmane=2Ecomp=2Epython=2Egeneral:=0D=0A> =0D=0A> > Simpl= e question:=0D=0A> >=0D=0A> > [myClass() for myClass in myClasses]=0D=0A> >= vs=0D=0A> > [MyClass() for MyClass in myClasses]=0D=0A> >=0D=0A> =0D=0A> = The recommended naming scheme for Python is that class DEFINITIONS=0D=0A> b= egin capitalized=2E Instances, methods/attributes, functions begin=0D=0A> l= owercase=2E=0D=0A> =0D=0A> I abstain from the argument about camel-case vs= _ (Ada "pretty=0D=0A> printers" automatically capitalize at _, so _ is com= mon in Ada)=0D=0A> =0D=0A> class MyClass(object):=0D=0A> def myMethod(self= ):=0D=0A=0D=0AAre you (the OP) using Python 2 or 3? In python 2 list=0D=0Ac= omprehensions leak; if you use MyClass as the list=0D=0Acomprehension varia= ble name it will overwrite the=0D=0AMyClass class definition (if it exists)= =2E=0D=0A=0D=0A>>> class MyClass(object):=0D=0A=2E=2E=2E pass=0D=0A=2E= =2E=2E =0D=0A>>> print MyClass=0D=0A=0D= =0A>>> _ =3D [ MyClass for MyClass in xrange( 5 ) ]=0D=0A>>> print MyClass= =0D=0A4=0D=0A=0D=0A=0D=0ARamit=0D=0A=0D=0A=0D=0AThis email is confidential = and subject to important disclaimers and=0D=0Aconditions including on offer= s for the purchase or sale of=0D=0Asecurities, accuracy and completeness of= information, viruses,=0D=0Aconfidentiality, legal privilege, and legal ent= ity disclaimers,=0D=0Aavailable at http://www=2Ejpmorgan=2Ecom/pages/disclo= sures/email=2E