Good Form

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Oct 21 05:10:11 EDT 2006


phez.asap at gmail.com writes:

> I am new to Python but come from a C++ background so I am trying to
> connect the dots :)

Welcome, and commiserations on your harsh upbringing :-)

> I am really liking what I see so far but have
> some nubee questions on what is considered good form.

This document is an official proposal for "good style" for code in the
Python standard library. Most consider it a good style reference for
all Python code.

    <URL:www.python.org/dev/peps/pep-0008/>

> For one thing I am used to class variables being accessable only
> through methods instaed of directly refrenced from the object
> instence. From what I have read it looks like when you access a
> class variable directly in Python it has something in the background
> that works similar to a getter of setter.

This document was written specifically for those coming from Java, but
many of its points would also be applicable to the C++ mindset.

    <URL:http://dirtsimple.org/2004/12/python-is-not-java.html>

This one responds to the above, and specifically addresses getters and
setters.

    <URL:http://simon.incutio.com/archive/2004/12/03/getters>

Here's a couple more, also responding to the same article.

    <URL:http://naeblis.cx/rtomayko/2004/12/15/the-static-method-thing>
    <URL:http://naeblis.cx/articles/2005/01/20/getters-setters-fuxors>

-- 
 \       "It is forbidden to steal hotel towels. Please if you are not |
  `\        person to do such is please not to read notice."  -- Hotel |
_o__)                                         sign, Kowloon, Hong Kong |
Ben Finney




More information about the Python-list mailing list