Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #30316
| 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 | <ramit.prasad@jpmorgan.com> |
| 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" <ramit.prasad@jpmorgan.com> |
| To | "python-list@python.org" <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 | <CAN1F8qUxbhK8HqRr7RVUQreb2QkAsm+Y9q0LKR0eK1akYbNsLg@mail.gmail.com> <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 <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.1505.1348767725.27098.python-list@python.org> (permalink) |
| 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 |
Show key headers only | View raw
Dennis Lee Bieber wrote: > Sent: Sunday, September 23, 2012 11:53 AM > To: python-list@python.org > Subject: Re: Capitalization for variable that holds a class > > On Sun, 23 Sep 2012 16:48:38 +0100, Joshua Landau > <joshua.landau.ws@gmail.com> declaimed the following in > gmane.comp.python.general: > > > Simple question: > > > > [myClass() for myClass in myClasses] > > vs > > [MyClass() for MyClass in myClasses] > > > > The recommended naming scheme for Python is that class DEFINITIONS > begin capitalized. Instances, methods/attributes, functions begin > lowercase. > > I abstain from the argument about camel-case vs _ (Ada "pretty > printers" automatically capitalize at _, so _ is common in Ada) > > class MyClass(object): > def myMethod(self): Are you (the OP) using Python 2 or 3? In python 2 list comprehensions leak; if you use MyClass as the list comprehension variable name it will overwrite the MyClass class definition (if it exists). >>> class MyClass(object): ... pass ... >>> print MyClass <class '__pieshell__.MyClass'> >>> _ = [ MyClass for MyClass in xrange( 5 ) ] >>> print MyClass 4 Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: Capitalization for variable that holds a class "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-09-27 17:20 +0000
csiph-web