Allowing non-ASCII identifiers

Brian Quinlan brian at sweetapp.com
Fri Feb 13 15:45:28 EST 2004


> So other programming languages make non-ASCII characters possible but
> English-speakers do not end up paying any price. So what's the problem?

If we ever need to read any Python code that uses non-ASCII characters then
we pay a price.

> Panic in the Python world strikes me as just FUD.

I'm not panicking; I'm just arguing that expending considerable effort to
add a feature that may cause problems might not be a good idea. I don't have
a very strong opinion on this issue.
 
> We are getting a little off track. Nobody really proposed to borrow C#'s
> identifier syntax whole hog (i.e have a keyword-escaping mechanism). I
> proposed to learn from C# and Java. They allow non-ASCII keywords and
> nobody seems to be hurt by it.

Did you mean to say that they "allow non-ASCII keywords"? Assuming you meant
identifiers, I don't find that argument convincing because the lack of
widespread problems might be related to the lack of widespread usage.

> As far as "reasonable usage" of non-English identifiers. Non-English
> speakers tell me that this is reasonable and I trust them to understand
> their situation better than I do!

This is a more convincing argument.
 
> But as an aside, the idea of allowing keywords to also be identifiers
> (with appropriate escaping syntax) is not a bad ones.

But it isn't really necessary in Python since defining/calling a method
using a string is trivial. In C# it is a lot of work.

> Let's say you are calling an XML-RPC server that uses a method name that
> happens to also be a Python keyword (e.g. "yield"). Of course your
> XML-RPC API could have a specific way of working around this but knowing
> the way the Python world works, it will use a different convention than
> your COM API which will use a different convention than your SOAP API
> which will use a different convention than your PyObjectiveC API, etc.
> Why not have the language standardize?

I'm not sure that the API necessarily needs to know anything about this
problem. The API user just has to use the usual Python mechanisms to
work-around the issue e.g.

someComObject.getattr('yield')(2,3)
someRPCServer.getattr('yield')(2,3)

class myComObject:
    def _yield(self, x, y):

setattr(myComObject, "yield", myComObject._yield)

Cheers,
Brian





More information about the Python-list mailing list