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

P

Peng Yu

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
 
D

Daniel Fetchinson

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
 
D

Dave Angel

Peng said:
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
 
S

Simon Forman

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,962
Messages
2,570,134
Members
46,692
Latest member
JenniferTi

Latest Threads

Top