Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-16 Thread Wolfgang
Hi, >> I hope new stuff will follow only one naming style. And now we should >> (or one person :-) should) decide which one. > > I guess my point boils down to, we already did decide 4 years ago. > Let's stick with what we've got. Ok, then let's stick with lower_case and check this if new librar

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Barry Warsaw
On Thu, 2005-12-15 at 11:35 -0800, Josiah Carlson wrote: > In regards to naming conventions, I find that CapWords are easier for me > to read and remember as a native speaker of english. I've heard > statements from non-native english speakers that CapWords are hard to > read and/or understand, b

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-15 Thread Barry Warsaw
On Thu, 2005-12-15 at 11:22 +0100, [EMAIL PROTECTED] wrote: > I hope new stuff will follow only one naming style. And now we should > (or one person :-) should) decide which one. I guess my point boils down to, we already did decide 4 years ago. Let's stick with what we've got. -Barry signatu

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-15 Thread wolfgang . langner
Hi, >>> Too late. I don't think the diversity is all that distracting. >> I disagree. One of the things that Java got very much right was to >> specify, from the very beginning, what the preferred conventions are >> for naming conventions. (Packages in lowercase, Classes in CapWords, >> methods an

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Josiah Carlson
Reinhold Birkenfeld <[EMAIL PROTECTED]> wrote: > Ian Bicking wrote: > > Guido van Rossum wrote: > >> It doesn't matter. Many large projects are adopting the camelCase > >> convention, either by choice or by accident. I did a brief review of > >> Zope 3 and Chandler, and while neither is consistent

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Steve Holden
François Pinard wrote: > [Guido van Rossum] > > >>In a module where you import 'foo' I don't understand why you would >>name a local variable 'foo'. So I'm not sure how the conflict would >>arise. > > > It goes the other way around. First suppose, following an example in > a previous message,

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Wolfgang
Hi, Barry Warsaw wrote: > That's fine. As always, projects (especially big framework-y ones like > Zope and Chandler) are free to adopt whatever they want. Their internal > consistency is more important anyway than adherence to PEP 8. > > PEP 8 though is primarily about establishing guidelines

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Aahz
On Thu, Dec 15, 2005, Barry Warsaw wrote: > > PEP 8 though is primarily about establishing guidelines for the standard > library. The underline_words recommendation has been in place for 4+ > years now, and modules that have been written in that time frame have > been written against to those rule

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread François Pinard
[Guido van Rossum] >In a module where you import 'foo' I don't understand why you would >name a local variable 'foo'. So I'm not sure how the conflict would >arise. It goes the other way around. First suppose, following an example in a previous message, that I have a lot of variables named 'tex

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Barry Warsaw
On Wed, 2005-12-14 at 20:41 -0800, Guido van Rossum wrote: > On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > > On Thu, 2005-12-15 at 11:13 +1100, Dave Cole wrote: > > > > > The only thing I strongly disagree with is the promotion of javaNaming > > > to equal footing with python_naming. > > >

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Barry Warsaw
On Wed, 2005-12-14 at 18:42 -0800, Guido van Rossum wrote: > > Deprecated functions could be listed, too. > > I think that's more proper for a separate PEP -- the style guide > shouldn't have to be updated each time something else is deprecated. +1 to that, although I won't write that PEP. If s

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Barry Warsaw
On Wed, 2005-12-14 at 20:22 -0600, Ian Bicking wrote: > I think the reference to Emacs here is unneeded. "Use 4 spaces per > indentation level" is sufficient instruction on its own. Agreed. I've removed all references to Emacs in the PEP. > I think the reference to PEP 263 tests is kind of ob

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Barry Warsaw
On Wed, 2005-12-14 at 20:09 -0600, Ian Bicking wrote: > I think it's reasonable to loosen the > phrasing a bit -- it's nearly always better to stay consistent with a > package than follow PEP 8 on this point. I agree, but actually I think there's a wider point to be made. The worst of all poss

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Reinhold Birkenfeld
Ian Bicking wrote: > Guido van Rossum wrote: >> On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: >> >>>On Thu, 2005-12-15 at 11:13 +1100, Dave Cole wrote: >>> >>> The only thing I strongly disagree with is the promotion of javaNaming to equal footing with python_naming. >>> >>>Actually

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Barry Warsaw
On Wed, 2005-12-14 at 17:04 -0800, Guido van Rossum wrote: > > One question: you made the suggestion that a blank line separate the > > last line in a tqs docstring from its closing tqs. I'm wondering why > > that is. Note that python-mode now (or shall we say with the fix I just > > made ;) pro

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Nicola Larosa
> Lately I've taken to putting a separator like this > between consecutive class definitions of any substantial > size: > > #--- > > I find it helps a lot when I'm skimming through looking > for the beginnings of classes. An editor/IDE with fol

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-15 Thread Greg Ewing
Guido van Rossum wrote: > You *might* want > to separate classes with two blank lines if the methods within them > are separated by single blank lines, but even there it's probably > overkill. Lately I've taken to putting a separator like this between consecutive class definitions of any substant

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-15 Thread wlangner
Hi, >>> Too late. I don't think the diversity is all that distracting. >> I disagree. One of the things that Java got very much right was to >> specify, from the very beginning, what the preferred conventions are >> for naming conventions. (Packages in lowercase, Classes in CapWords, >> methods an

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Phillip J. Eby
At 11:50 PM 12/14/2005 -0600, Ian Bicking wrote: >Guido van Rossum wrote: > > On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > > > >>On Thu, 2005-12-15 at 11:13 +1100, Dave Cole wrote: > >> > >> > >>>The only thing I strongly disagree with is the promotion of javaNaming > >>>to equal footing

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Ian Bicking
Guido van Rossum wrote: > On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > >>On Thu, 2005-12-15 at 11:13 +1100, Dave Cole wrote: >> >> >>>The only thing I strongly disagree with is the promotion of javaNaming >>>to equal footing with python_naming. >> >>Actually, they're not on equal footing

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Guido van Rossum
On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Thu, 2005-12-15 at 11:13 +1100, Dave Cole wrote: > > > The only thing I strongly disagree with is the promotion of javaNaming > > to equal footing with python_naming. > > Actually, they're not on equal footing atm. I happen to agree with yo

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Guido van Rossum
On 12/14/05, François Pinard <[EMAIL PROTECTED]> wrote: > I do not understand your statement that module/package names can only > conflict with *global* user variable names. Local variables hide global > variables with same names, and imported modules are often global > variables. So, using a loc

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Barry Warsaw
On Thu, 2005-12-15 at 11:13 +1100, Dave Cole wrote: > The only thing I strongly disagree with is the promotion of javaNaming > to equal footing with python_naming. Actually, they're not on equal footing atm. I happen to agree with you though. -Barry signature.asc Description: This is a digit

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread François Pinard
[Guido van Rossum] >On 12/14/05, François Pinard <[EMAIL PROTECTED]> wrote: >> I would like that PEP 0008 add some cement around this idea that common >> English words, properly spelled, which are likely to be user variable >> names, be avoided whenever reasonable. >I don't think that's a reasona

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Tony Meyer
[Barry] >>> I've pushed out a revised PEP 8 >>> >>> http://www.python.org/peps/pep-0008.html >>> >>> Please review and comment. [Tony Meyer] >> Why does PEP 8 continually refer to one particular editor (Emacs)? [Guido] > I think the best way to avoid editor wars is to pick one editor and > stick

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Guido van Rossum
On 12/14/05, François Pinard <[EMAIL PROTECTED]> wrote: > I would like that PEP 0008 add some cement around this idea that common > English words, properly spelled, which are likely to be user variable > names, be avoided whenever reasonable. I don't think that's a reasonable rule. There are too m

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Ian Bicking
Barry Warsaw wrote: > I've pushed out a revised PEP 8 > > http://www.python.org/peps/pep-0008.html Just two little things... Use 4 spaces per indentation level. This is the default for Emacs's python-mode. For really old code that you don't want to mess up, you can continue to

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread François Pinard
[Barry Warsaw] >I've pushed out a revised PEP 8 >http://www.python.org/peps/pep-0008.html >Please review and comment. Hi, Barry, and people. Allow me a few remarks, nothing essential. * Within "Naming Conventions", "Prescriptive: Naming Conventions", "Module names", we read: Modules shou

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Ian Bicking
Dave Cole wrote: > Barry Warsaw wrote: > >>I've pushed out a revised PEP 8 >> >>http://www.python.org/peps/pep-0008.html >> >>Please review and comment. Thanks everyone for providing an excellent >>discussion. Hopefully I have captured our current collective >>recommendations. I've also tried t

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Guido van Rossum
On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > On Wed, 2005-12-14 at 14:10 -0800, Guido van Rossum wrote: > > > Thanks, Barry! I've made another pass and added a couple more tweaks, > > hopefully non-controversial. > > Cool thanks Guido. I fixed a couple of small typos. > > One question: y

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Dave Cole
Barry Warsaw wrote: > I've pushed out a revised PEP 8 > > http://www.python.org/peps/pep-0008.html > > Please review and comment. Thanks everyone for providing an excellent > discussion. Hopefully I have captured our current collective > recommendations. I've also tried to simplify the text, w

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Barry Warsaw
On Wed, 2005-12-14 at 14:14 -0800, Guido van Rossum wrote: > Historically many Python developers use Emacs. Barry & I still do. > > I think the best way to avoid editor wars is to pick one editor and > stick with it. :-) Dinosaurs rule! :) -Barry signature.asc Description: This is a digitall

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Barry Warsaw
On Wed, 2005-12-14 at 14:10 -0800, Guido van Rossum wrote: > Thanks, Barry! I've made another pass and added a couple more tweaks, > hopefully non-controversial. Cool thanks Guido. I fixed a couple of small typos. One question: you made the suggestion that a blank line separate the last line in

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Guido van Rossum
On 12/14/05, Tony Meyer <[EMAIL PROTECTED]> wrote: > > I've pushed out a revised PEP 8 > > > > http://www.python.org/peps/pep-0008.html > > > > Please review and comment. > > Why does PEP 8 continually refer to one particular editor (Emacs)? > (There are even parts in the form "x is better because

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Guido van Rossum
On 12/14/05, Barry Warsaw <[EMAIL PROTECTED]> wrote: > I've pushed out a revised PEP 8 > > http://www.python.org/peps/pep-0008.html > > Please review and comment. Thanks everyone for providing an excellent > discussion. Hopefully I have captured our current collective > recommendations. I've als

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Tony Meyer
> I've pushed out a revised PEP 8 > > http://www.python.org/peps/pep-0008.html > > Please review and comment. Why does PEP 8 continually refer to one particular editor (Emacs)? (There are even parts in the form "x is better because it works better in Emacs", when surely it's actually the case

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Brett Cannon
On 12/14/05, Michael Chermside <[EMAIL PROTECTED]> wrote: > Guido writes: > > Actually this (function, method and ivar names) is such a contentious > > issue that I think the style guide should explicitly allow all > > two/three styles and recommend to be consistent within a class, module > > or pa

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Barry Warsaw
I've pushed out a revised PEP 8 http://www.python.org/peps/pep-0008.html Please review and comment. Thanks everyone for providing an excellent discussion. Hopefully I have captured our current collective recommendations. I've also tried to simplify the text, while making it (somewhat) more pre

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Barry Warsaw
On Wed, 2005-12-14 at 10:17 -0800, Guido van Rossum wrote: > Actually this (function, method and ivar names) is such a contentious > issue that I think the style guide should explicitly allow all > two/three styles and recommend to be consistent within a class, module > or package. My own feeling

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Barry Warsaw
On Wed, 2005-12-14 at 09:08 -0800, Michael Chermside wrote: > Wolfgang writes: > > We need a clear style for function and method names > > now std lib uses "foo_bar" sometimes "foobar" > > and sometimes "fooBar". > > Personally, I prefer "fooBar". But I try not to use it in python > code... I try

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Barry Warsaw
On Tue, 2005-12-13 at 12:00 -0500, Phillip J. Eby wrote: > In any case, the algorithms involved are near-trivial; the most complex > piece is the processing of complex version specifications like > "CherryPy>=2.1.0,!=2.1.1-rc2,<2.2a" into a series of version intervals. > > The only outstanding

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-14 Thread Barry Warsaw
On Tue, 2005-12-13 at 07:26 -0500, Jim Fulton wrote: > I'd add somewhere: "If in doubt, chose non-public. You can always change your > mind later." Added. > > > We don't use the term "private" here, since no attribute is really > > private in Python (without a generally unnecessary

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Michael Chermside
Guido writes: > Actually this (function, method and ivar names) is such a contentious > issue that I think the style guide should explicitly allow all > two/three styles and recommend to be consistent within a class, module > or package. Hurray! Now I can go back to using capWords for functions, m

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Guido van Rossum
On 12/14/05, Wolfgang <[EMAIL PROTECTED]> wrote: > Hello, > > PEP 8 for function and method names: > - > Function Names > >Function names should be lowercase, possibly with words separated by >underscores to improve readability. mixedCase is allowed only in >contexts wh

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Michael Chermside
Wolfgang writes: > We need a clear style for function and method names > now std lib uses "foo_bar" sometimes "foobar" > and sometimes "fooBar". Personally, I prefer "fooBar". But I try not to use it in python code... I try to always use "foo_bar" because that's what PEP 8 says. I believe recall

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Wolfgang
Hi, Michael Hoffman wrote: > [Wolfgang] > >> Or should we switch to camelCase with lowercase first letter ? >> As most other Languages prefer this (Java, C#, C++, ...) > > They also use curly braces instead of indentation to indicate block > structure. Maybe we should switch to that too. Or BE

Re: [Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Michael Hoffman
[Wolfgang] > Or should we switch to camelCase with lowercase first letter ? > As most other Languages prefer this (Java, C#, C++, ...) They also use curly braces instead of indentation to indicate block structure. Maybe we should switch to that too. -- Michael Hoffman <[EMAIL PROTECTED]> Europe

[Python-Dev] PEP 8 updates/clarifications, function/method style

2005-12-14 Thread Wolfgang
Hello, PEP 8 for function and method names: - Function Names Function names should be lowercase, possibly with words separated by underscores to improve readability. mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py),

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Jason Orendorff
Barry Warsaw wrote: > - If your class is intended to be subclassed, and you have attributes > that you do not want subclasses to use, consider naming them with > double leading underscores and no trailing underscores. This invokes > Python's name mangling algorithm, w

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Guido van Rossum
On 12/13/05, Jim Fulton <[EMAIL PROTECTED]> wrote: > Personally, I'd rather just sort aphabetically based on dotted package > name. Because packages provide meaningful groupings to begin with, > this approach provides the most meaningful groupings to me. (All of > my "internal" modules are in pac

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Phillip J. Eby
At 07:26 AM 12/13/2005 -0500, Jim Fulton wrote: >Personally, I'd actively discourage use of trivial accessors. Simple >attribute access is not only "fine", IMO, but it is much better than >trivial accessors. This is an important point, IMO, because, in my >experience, the vast majority of accesso

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Phillip J. Eby
At 03:25 PM 12/13/2005 +, Michael Hoffman wrote: >[Jim Fulton] > > Sure, if you only have one module, and if your module doesn't do any > > dynamic imports, and if the things your importing don't have dependencies, > > and ... > > > > I think it would be simpler to have a formal dependency syst

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Ian Bicking
Jim Fulton wrote: >> stdlib, external modules, internal modules seems like enough ordering >> to me. If you want to order things more exactly, sure, but I don't >> really see the point personally. Since I can't assume as a reader >> that imports are ordered in any way I have to search to be su

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Michael Hoffman
[Jim Fulton] >>> Personally, I don't find the stdlib/external distinction to be useful. [Michael Hoffman] >> It's useful because it allows one to quickly see all the prerequisites >> need to be installed in one place. [Jim Fulton] > Sure, if you only have one module, and if your module doesn't do

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread skip
Jim> Personally, I don't find the stdlib/external distinction to be Jim> useful. For me it's just a "who do I blame for problems" sort of thing. Most of the time I know, but others looking at my code might not know that MySQLdb isn't in the core but that bsddb is. Skip _

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread skip
Nick> Having to type '(object)' all the time is annoying, but less Nick> annoying than trying to figure out which set of semantics a given Nick> class is using. Sure. Since I started writing Python long before new-style classes were around, I have lots of classic classes. My default

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Jim Fulton
Michael Hoffman wrote: > [Ian Bickling] > >>>stdlib, external modules, internal modules seems like enough >>>ordering to me. > > > [Jim Fulton] > >>Personally, I don't find the stdlib/external distinction to be useful. > > > It's useful because it allows one to quickly see all the prerequisit

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Michael Hudson
Guido van Rossum <[EMAIL PROTECTED]> writes: > Dotted non-from imports (e.g. import test.pystone) are rare enough > that they don't deserve a special rule; if you want me to give a rule, > I think they should be mixed in with the undotted ones, > alphabetically. I actually really hate this style,

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Michael Hoffman
[Ian Bickling] >> stdlib, external modules, internal modules seems like enough >> ordering to me. [Jim Fulton] > Personally, I don't find the stdlib/external distinction to be useful. It's useful because it allows one to quickly see all the prerequisites need to be installed in one place. -- Mic

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Jim Fulton
Barry Warsaw wrote: > On Sun, 2005-12-11 at 11:20 -0500, Jim Fulton wrote: > > >>This seems outdated. My impression, in part from time spent >>working with the Python Labs guys, is that it is fine to have public >>data sttributes even for non-"record" types. In fact, I would argue that >>any ti

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Jim Fulton
Barry Warsaw wrote: > On Sun, 2005-12-11 at 16:30 -0600, Ian Bicking wrote: > > >>Potentially it could be added that the whole issue can often be avoided >>when an object's methods perform actions instead of returning attributes >>of the object. It's a long topic; maybe it could even just be a

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Jim Fulton
[EMAIL PROTECTED] wrote: > Jim> I don't understand this argument. Any mutating method or property > Jim> invoked by foreign code changes an object's state. > > Sure, but the only place I need to look for direct changes to the object's > state are in the object's own code. > > Jim>

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Jim Fulton
Ian Bicking wrote: > Barry Warsaw wrote: ... >>>This seems too complex to me for PEP 8. >> >> >>Really? ISTR adopting this convention from Guido, but I'm not 100% sure >>about that. After having used it for several years now, I do really >>like this style, but I'm willing to leave the recommenda

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Gustavo J. A. M. Carneiro
Seg, 2005-12-12 às 22:38 -0600, [EMAIL PROTECTED] escreveu: > Jim> I don't understand this argument. Any mutating method or property > Jim> invoked by foreign code changes an object's state. > > Sure, but the only place I need to look for direct changes to the object's > state are in th

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-13 Thread Nick Coghlan
[EMAIL PROTECTED] wrote: > Nick> Any old code could be fixed by putting "from types import > Nick> ClassType as __metaclass__" at the top of the affected modules. > > Which would be, what, 90% of all Python code written that defines classes? I generally don't allow old-style classes in an

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Tony Meyer
>> * Python core modules/packages >> >> * Third-party modules/packages >> >> * Local modules/packages > > This is already in PEP 8: [...] >1. standard library imports >2. related major package imports (i.e. all email package > imports > next) >3. application sp

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Guido van Rossum
On 12/12/05, Ian Bicking <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > This is subjective enough that I would think some rationale explaining this > > convention should be given. Personally, I group imports into three sections > > as follows: > > > > * Python core modules/packages

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Ian Bicking
[EMAIL PROTECTED] wrote: > This is subjective enough that I would think some rationale explaining this > convention should be given. Personally, I group imports into three sections > as follows: > > * Python core modules/packages > > * Third-party modules/packages > > * Local module

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Guido van Rossum
On 12/12/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >> I looked at that too, but most of these didn't jump out at me. I'll > >> copy in the parts that aren't already in PEP 8 that seem possible: > >> > >> From-imports should follow non-from imports. Dotted imports should

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread skip
Jim> I don't understand this argument. Any mutating method or property Jim> invoked by foreign code changes an object's state. Sure, but the only place I need to look for direct changes to the object's state are in the object's own code. Jim> If you provide a property or a pair if

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread skip
>> I looked at that too, but most of these didn't jump out at me. I'll >> copy in the parts that aren't already in PEP 8 that seem possible: >> >> From-imports should follow non-from imports. Dotted imports should >> follow non-dotted imports. Non-dotted imports should be

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Ian Bicking
Alex Martelli wrote: > On 12/12/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: >... > >>I'd rather see 'metaclass' fully spelled out than resort to 'mcl'; >>metaclass code is tricky enough to write without figuring out >>abbreviations. :) >> >>Indeed, the only reason I use 'cls' is because it

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Alex Martelli
On 12/12/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: ... > I'd rather see 'metaclass' fully spelled out than resort to 'mcl'; > metaclass code is tricky enough to write without figuring out > abbreviations. :) > > Indeed, the only reason I use 'cls' is because it was Pronounced the > standard

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Phillip J. Eby
At 02:59 PM 12/12/2005 -0800, Alex Martelli wrote: >On 12/12/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > > At 02:25 PM 12/12/2005 -0600, Ian Bicking wrote: > > >That looks good to me. Well, I actually try not to use cls as the first > > >argument to metaclass's __new__ method, because there's

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Alex Martelli
On 12/12/05, Phillip J. Eby <[EMAIL PROTECTED]> wrote: > At 02:25 PM 12/12/2005 -0600, Ian Bicking wrote: > >That looks good to me. Well, I actually try not to use cls as the first > >argument to metaclass's __new__ method, because there's so many classes > >being tossed about at that point that I

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Phillip J. Eby
At 02:25 PM 12/12/2005 -0600, Ian Bicking wrote: >That looks good to me. Well, I actually try not to use cls as the first >argument to metaclass's __new__ method, because there's so many classes >being tossed about at that point that I try to be more explicit. But I >don't consider that a common

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Ian Bicking
Barry Warsaw wrote: > On Fri, 2005-12-09 at 17:19 -0600, Ian Bicking wrote: > > >>I personally feel "cls" should be used for classmethods, and not >>elsewhere. Just like I wouldn't like someone using "self" outside of >>the first argument of instance methods. So class_ still would be a good

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Ian Bicking
Raymond Hettinger wrote: >>Do not use accessor methods, like ``obj.getFoo()`` and >>``obj.setFoo(v)``, instead just expose a public attribute > > (``obj.foo``). > > This advice is, of course, not appropriate for all users (properties are > not typically in a Python beginner's skill set) or all us

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Phillip J. Eby
At 11:35 AM 12/12/2005 -0600, [EMAIL PROTECTED] wrote: > >> In my experience it's difficult to find the locations where another > >> module mucks with your object's state. Using properties or accessor > >> methods coupling between modules is reduced and you can be more > >> confide

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Jim Fulton
[EMAIL PROTECTED] wrote: > Jim> That's why, in my suggested writeup, I suggested that attributes > Jim> should be used if the accessors are trivial. > > In my experience it's difficult to find the locations where another module > mucks with your object's state. Using properties or accesso

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Barry Warsaw
On Sun, 2005-12-11 at 16:30 -0600, Ian Bicking wrote: > Potentially it could be added that the whole issue can often be avoided > when an object's methods perform actions instead of returning attributes > of the object. It's a long topic; maybe it could even just be a link, > if someone knows

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Barry Warsaw
On Fri, 2005-12-09 at 17:19 -0600, Ian Bicking wrote: > I personally feel "cls" should be used for classmethods, and not > elsewhere. Just like I wouldn't like someone using "self" outside of > the first argument of instance methods. So class_ still would be a good > spelling elsewhere. Here

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread skip
>> In my experience it's difficult to find the locations where another >> module mucks with your object's state. Using properties or accessor >> methods coupling between modules is reduced and you can be more >> confident that the only place an object's state is modified directly

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Barry Warsaw
On Sun, 2005-12-11 at 11:20 -0500, Jim Fulton wrote: > This seems outdated. My impression, in part from time spent > working with the Python Labs guys, is that it is fine to have public > data sttributes even for non-"record" types. In fact, I would argue that > any time you would be tempted to

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Phillip J. Eby
At 09:59 AM 12/12/2005 -0600, [EMAIL PROTECTED] wrote: > Jim> That's why, in my suggested writeup, I suggested that attributes > Jim> should be used if the accessors are trivial. > >In my experience it's difficult to find the locations where another module >mucks with your object's state.

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread skip
Jim> That's why, in my suggested writeup, I suggested that attributes Jim> should be used if the accessors are trivial. In my experience it's difficult to find the locations where another module mucks with your object's state. Using properties or accessor methods coupling between modules

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread skip
Nick> Any old code could be fixed by putting "from types import Nick> ClassType as __metaclass__" at the top of the affected modules. Which would be, what, 90% of all Python code written that defines classes? Skip ___ Python-Dev mailing list Py

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Gustavo J. A. M. Carneiro
Dom, 2005-12-11 às 16:30 -0600, Ian Bicking escreveu: > Jim Fulton wrote: > >> Designing for inheritance > >> > >>Always decide whether a class's methods and instance variables > >>should be public or non-public. In general, never make data > >>variables public unless

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Jim Fulton
Gustavo J. A. M. Carneiro wrote: ... > IMHO, if getting a property involves a potentially long computation, > it's better to have an accessor method rather than a property; > xpto.getFoobar() hints right away the programmer that to access that > value some code has to be run, so the programmer i

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Jim Fulton
Raymond Hettinger wrote: >>Do not use accessor methods, like ``obj.getFoo()`` and >>``obj.setFoo(v)``, instead just expose a public attribute > > (``obj.foo``). > > This advice is, of course, not appropriate for all users (properties are > not typically in a Python beginner's skill set) Really?

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Jim Fulton
[EMAIL PROTECTED] wrote: > Ian> Do not use accessor methods, like ``obj.getFoo()`` and > Ian> ``obj.setFoo(v)``, instead just expose a public attribute > Ian> (``obj.foo``). If necessary you can use ``property`` to implement > Ian> the same functionality that accessor methods would

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-12 Thread Nick Coghlan
Guido van Rossum wrote: > On 12/11/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: >> Josiah Carlson wrote: >>> [EMAIL PROTECTED] wrote: Ian> Do not use accessor methods, like ``obj.getFoo()`` and Ian> ``obj.setFoo(v)``, instead just expose a public attribute Ian> (``obj.foo`

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread Guido van Rossum
On 12/11/05, Nick Coghlan <[EMAIL PROTECTED]> wrote: > Josiah Carlson wrote: > > [EMAIL PROTECTED] wrote: > >> Ian> Do not use accessor methods, like ``obj.getFoo()`` and > >> Ian> ``obj.setFoo(v)``, instead just expose a public attribute > >> Ian> (``obj.foo``). If necessary you can u

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread Nick Coghlan
Josiah Carlson wrote: > [EMAIL PROTECTED] wrote: >> Ian> Do not use accessor methods, like ``obj.getFoo()`` and >> Ian> ``obj.setFoo(v)``, instead just expose a public attribute >> Ian> (``obj.foo``). If necessary you can use ``property`` to implement >> Ian> the same functionality

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread skip
>> Don't properties only work with new-style clsses? If so, this should >> probably be noted. Josiah> In the future, aren't all classes going to become new-style? Sure, but PEP 8 should be accurate for current Python. <0.5 wink> Josiah> Was it going to wait until Py3k, or somet

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread Josiah Carlson
[EMAIL PROTECTED] wrote: > Ian> Do not use accessor methods, like ``obj.getFoo()`` and > Ian> ``obj.setFoo(v)``, instead just expose a public attribute > Ian> (``obj.foo``). If necessary you can use ``property`` to implement > Ian> the same functionality that accessor methods woul

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread Raymond Hettinger
> Do not use accessor methods, like ``obj.getFoo()`` and > ``obj.setFoo(v)``, instead just expose a public attribute (``obj.foo``). This advice is, of course, not appropriate for all users (properties are not typically in a Python beginner's skill set) or all use cases. It is closer to one person

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread skip
Ian> Do not use accessor methods, like ``obj.getFoo()`` and Ian> ``obj.setFoo(v)``, instead just expose a public attribute Ian> (``obj.foo``). If necessary you can use ``property`` to implement Ian> the same functionality that accessor methods would give you. Don't properties onl

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread Nick Coghlan
Jim Fulton wrote: > FWIW, as a general rule, I like using a single trailing underscore, > especially for keywords. It allows the use of meaningful and easy > to remember names. When the name of a variable should be "class" or > "for" or whatever, it's easy, as a Python programmer, to remember tha

Re: [Python-Dev] PEP 8 updates/clarifications

2005-12-11 Thread Jim Fulton
Ian Bicking wrote: > Jim Fulton wrote: > >>> Designing for inheritance >>> >>>Always decide whether a class's methods and instance variables >>>should be public or non-public. In general, never make data >>>variables public unless you're implementing essentially a >>>

  1   2   >