Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > What are the naming convention for private member variable, andprivate and public member function?

Reply
Thread Tools

What are the naming convention for private member variable, andprivate and public member function?

 
 
Peng Yu
Guest
Posts: n/a
 
      09-20-2009
Hi,

It says in http://www.python.org/dev/peps/pep-0008/

" Method Names and Instance Variables

Use the function naming rules: lowercase with words separated by
underscores as necessary to improve readability.

Use one leading underscore only for non-public methods and
instance
variables."

I am wondering what is the different between member function and
member variable in term of naming convention.

Regards,
Peng
 
Reply With Quote
 
 
 
 
Daniel Fetchinson
Guest
Posts: n/a
 
      09-20-2009
> It says in http://www.python.org/dev/peps/pep-0008/
>
> " Method Names and Instance Variables
>
> Use the function naming rules: lowercase with words separated by
> underscores as necessary to improve readability.
>
> Use one leading underscore only for non-public methods and
> instance
> variables."
>
> I am wondering what is the different between member function and
> member variable in term of naming convention.


Nothing that I know of. If they are "private" they should both start
with an underscore, if they are "public" they should not.

HTH,
Daniel



--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
 
Reply With Quote
 
 
 
 
Dave Angel
Guest
Posts: n/a
 
      09-20-2009
Peng Yu wrote:
> Hi,
>
> It says in http://www.python.org/dev/peps/pep-0008/
>
> " Method Names and Instance Variables
>
> Use the function naming rules: lowercase with words separated by
> underscores as necessary to improve readability.
>
> Use one leading underscore only for non-public methods and
> instance
> variables."
>
> I am wondering what is the different between member function and
> member variable in term of naming convention.
>
> Regards,
> Peng
>
>

Member functions are verbs or sometimes adjectives, while member
variables are nouns.

DaveA

 
Reply With Quote
 
Simon Forman
Guest
Posts: n/a
 
      09-21-2009
On Sep 19, 11:33*pm, Peng Yu <(E-Mail Removed)> wrote:
> Hi,
>
> It says inhttp://www.python.org/dev/peps/pep-0008/
>
> " * *Method Names and Instance Variables
>
> * * * Use the function naming rules: lowercase with words separated by
> * * * underscores as necessary to improve readability.
>
> * * * Use one leading underscore only for non-public methods and
> instance
> * * * variables."
>
> I am wondering what is the different between member function and
> member variable in term of naming convention.
>
> Regards,
> Peng


The naming convention for both to indicate that attributes of a class
should be considered internal is a leading underscore.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSE 4 11-15-2006 02:40 AM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola MCSD 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments