On 11 Jun, 21:28, "Russ P." <[EMAIL PROTECTED]> wrote: > > All I did was to suggest that a keyword be added to Python to > designate private data and methods without cluttering my cherished > code with those ugly leading underscores all over the place. I don't > like that clutter any more than I like all those semi-colons in other > popular languages. I was originally attracted to Python for its clean > syntax, but when I learned about the leading-underscore convention I > nearly gagged.
I'm not bothered about having private instance data, but I think there's definitely a case to be answered about the double-underscore name-mangling convention. In the remote past, people were fairly honest about it being something of a hack, albeit one which had mostly satisfactory results, and unlike the private instance data argument which can often be countered by emphasising social measures, there has been genuine surprise about this particular method of preventing attribute name collisions - it's an issue which can trip up even careful programmers. Note also that the double-underscore convention is listed as a Python wart [1] and is described by Kuchling thus: "But it's a hack and a kludge; making privacy depend on an unrelated property such as the attribute's name is clumsy. At least this ugliness is limited to one specific and little-used case; few Python programmers ever bother to use this private variable feature." In my opinion there are too many people either defending the status quo (warts and all) or pushing the envelope in many areas that didn't overly bother people before (various Python 3000 features). Paul [1] http://wiki.python.org/moin/PythonWarts -- http://mail.python.org/mailman/listinfo/python-list