[Python-3000] PEP 3131 - the details
Hernan Martínez-Foffani
hernan at foffani.org
Thu May 17 11:35:19 CEST 2007
> > > The same as in .NET (and hence IronPython)?
> >
> > This kind of research is time consuming; it cost me an hour to come
> > up with above list. Please research it for yourself.
C# identifiers (cont)
About normalization and @
---------
Paragraph 2 (Page 56, Line 5)
1 An identifier in a conforming program must be in the canonical
format defined by Unicode Normalization Form C, as defined by Unicode
Standard Annex 15. 2 The behavior when encountering an identifier not
in Normalization Form C is implementation-defined; however, a
diagnostic is not required.
Paragraph 3 (Page 56, Line 8)
1 The prefix "@" enables the use of keywords as identifiers, which is
useful when interfacing with other programming languages. 2 The
character @ is not actually part of the identifier, so the identifier
might be seen in other languages as a normal identifier, without the
prefix. 3 An identifier with an @ prefix is called a verbatim
identifier. [Note: Use of the @ prefix for identifiers that are not
keywords is permitted, but strongly discouraged as a matter of style.
end note] [Example: The example:
class @class
{
public static void @static(bool @bool) {
if (@bool)
System.Console.WriteLine("true");
else
System.Console.WriteLine("false");
}
}
class Class1
{
static void M() {
cl\u0061ss.st\u0061tic(true);
}
}
defines a class named "class" with a static method named "static" that
takes a parameter named "bool". Note that since Unicode escapes are
not permitted in keywords, the token "cl\u0061ss" is an identifier,
and is the same identifier as "@class". end example]
Paragraph 4 (Page 56, Line 32)
1 Two identifiers are considered the same if they are identical after
the following transformations are applied, in order:
* 2 The prefix "@", if used, is removed.
* 3 Each unicode-escape-sequence is transformed into its
corresponding Unicode character.
* 4 Any formatting-characters are removed.
Paragraph 5 (Page 56, Line 37)
1 Identifiers containing two consecutive underscore characters
(U+005F) are reserved for use by the implementation; however, no
diagnostic is required if such an identifier is defined. [Note: For
example, an implementation might provide extended keywords that begin
with two underscores. end note]
-----------------
Same disclaimer as before applies.
Regards,
-Hernán.
More information about the Python-3000
mailing list