Nicholas Harman wrote:

I have done a little programming in BlueJ Java before but I decided to try
the “Python style” as explained in the chapter, using properties rather
than variables and getters and setters ..... My main question is:  When
using property and setter it seems I must use “__name” or “__volume”
(Python’s version of private variables).  Is this true?

Certainly not. Python doesn't enforce any naming convention on you. You can use any name you like. But you *should* use something like "__name" or "__volume", simply because that will be more sensible than most other names. But if you choose to use something else, Python won't stop you.

Note: you can also use just a single underscore, _name and _volume, to indicate that the attributes are private and should not be touched.


--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to