"Delaney, Timothy (Tim)" <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> This is just an idea of mine, nothing I expect python to adapt. >> But just suppose the language allowed for words in bold. A word >> in bold would be considered a reserved word, a word in non bold >> would be an identifier. > > Exactly how am I supposed to use my text editor to make words bold? Is > every text editor supposed to understand a "python format" for code?
I guess you would do it the same way other languages have implemented this in the past: use bold if your editor supports it and use something else if it doesn't. Algol 68 has the concept that keywords and identifiers with the same spelling are distinguished in some way (and if I remember correctly there were compiler options that let you specify what sort of stropping you were using). There was case stropping: case not otherwise being significant you could indicate a reserved word by uppercasing it e.g. BEGIN; or various punctuation conventions .begin. 'BEGIN' @begin or your editor might indicate reserved words using a different font e.g. bold. I see wikipedia's entry on stropping says that Atlas Autocode let you strop keywords by underlining them using backspace and overstrike. That must have been real fun to type. One of the big advantages of stropping is of course that you don't have to print or view source code using the same convention as you used when entering the text. So you might use case stropping to type your source code in, but then print listings with keywords bolded and lowercased. So for Python you would have a magic comment similar to how you specify encoding to specify the type of stropping in use and your editor would recognise the comment and display the file using whichever stropping convention you prefer for viewing. Personally I think a simpler idea to get round clashes of reserved words and identifiers would be to adopt something similar to c#'s @ escape. You could simply allow the lexer to accept @'something' as an alternative spelling for the identifier something, but with no restrictions on the characters that such an identifier could contain. so for manipulating html you would be able to write: element.@'class' = "whatever" instead of having to call setattr or use some other kludge. If Python did have a mechanism like this to escape identifiers then you could implement stropping completely outside the language: you could have an editor which displays keywords in one font and identifiers in another (as most editors already do), and then when saving simply escape any identifiers which are not otherwise valid. It wouldn't even be a big change: the editor could probably guess your intent correctly 99% of the time. -- http://mail.python.org/mailman/listinfo/python-list