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's what I've written:

    Function and method arguments

      Always use 'self' for the first argument to instance methods.

      Always use 'cls' for the first argument to class methods.

      If a function argument's name clashes with a reserved keyword, it is
      generally better to append a single trailing underscore rather than use
      an abbreviation or spelling corruption.  Thus "print_" is better than
      "prnt".

> 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 grouped by increasing
>    length, while dotted imports should be grouped roughly alphabetically.
> 
> 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 recommendation out of PEP
8.

-Barry

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to