Why is there no natural syntax for accessing attributes with names not being valid identifiers?

rusi rustompmody at gmail.com
Wed Dec 4 13:01:23 CET 2013


On Wednesday, December 4, 2013 3:59:06 PM UTC+5:30, Antoon Pardon wrote:
> Op 04-12-13 11:09, rusi schreef:
> > I used the spaces case to indicate the limit of chaos. 
> > Other characters (that
> > already have uses) are just as problematic.
>
> I don't agree with the latter. As it is now python can make the
> distinction between
>
> from A import B    and     fromAimportB.
>
> I see no a priori reason why this should be limited to letters. A
> language designer might choose to allow a bigger set of characters
> in identifiers like '-', '+' and others. In that case a-b would be
> an identifier and a - b would be the operation. Just as in python
> fromAimportB is an identifier and from A import B is an import
> statement.

Im not sure what you are saying.
Sure a language designer can design a language differently from python.
I mentioned lisp. Cobol is another behaving exactly as you describe.

My point is that when you do (something like) that, you will need to change the
lexical and grammatical structure of the language.  And this will make 
for rather far-reaching changes ALL OVER the language not just in what-follows-dot.

IOW: I dont agree that we have a disagreement :-)



More information about the Python-list mailing list