26 Oct
2012
26 Oct
'12
11:42 a.m.
On 26/10/12 20:22, Daniel Fetchinson wrote:
Hi folks,
Would it be a good idea to have a built-in list of strings containing the reserved identifiers of python such as 'assert', 'import', etc?
The reason I think this would be useful is that whenever I write a class with user defined methods I always have to exclude the reserved keywords. So for instance myinstance.mymethod( ) is okay but myinstance.assert( ) is not. In these cases I use the convention myinstance._assert( ), etc.
The usual convention is that leading underscores are private, and trailing underscores are used to avoid name clashes with reserved words. So myinstance.assert_ rather than myinstance._assert, which would be considered "private, do not use". -- Steven