Path: csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'python,': 0.02; 'subject:not': 0.03; 'allowed.': 0.07; 'differently': 0.07; 'wednesday,': 0.07; 'string': 0.09; 'identifier': 0.09; 'implements': 0.09; 'operator,': 0.09; 'spaces': 0.09; 'subject:Why': 0.09; 'python': 0.11; 'language.': 0.14; "wouldn't": 0.14; 'changes': 0.15; "'+'": 0.16; '(something': 0.16; 'alphabet': 0.16; 'identifier.': 0.16; 'identifiers': 0.16; 'identifiers,': 0.16; 'languages)': 0.16; 'letters.': 0.16; 'lexer': 0.16; 'lexical': 0.16; 'lisp': 0.16; 'operation.': 0.16; 'parser.': 0.16; 'python/c': 0.16; 'recognizable': 0.16; 'saying.': 0.16; 'sees': 0.16; 'statement.': 0.16; 'subject: \n ': 0.16; 'subject:accessing': 0.16; 'symbols': 0.16; 'all.': 0.16; 'language': 0.16; 'wrote:': 0.18; 'do.': 0.18; '>>>': 0.22; 'import': 0.22; 'saying': 0.22; 'header:User-Agent:1': 0.23; 'text.': 0.24; 'question': 0.24; 'this:': 0.26; 'certain': 0.27; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'bigger': 0.30; 'characters': 0.30; 'designer': 0.30; '>>>>': 0.31; 'behaving': 0.31; 'breaking': 0.31; 'concern': 0.31; 'ones.': 0.31; 'languages': 0.32; 'another': 0.32; 'entirely': 0.33; 'maybe': 0.34; 'could': 0.34; 'subject:with': 0.35; 'agree': 0.35; 'december': 0.35; 'etc': 0.35; 'but': 0.35; 'keyword': 0.36; 'possible': 0.36; 'subject:?': 0.36; 'should': 0.36; 'changing': 0.37; 'being': 0.38; 'others.': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'rather': 0.38; 'that,': 0.38; 'structure': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'enough': 0.39; 'how': 0.40; 'is.': 0.60; 'most': 0.60; 'mentioned': 0.61; 'choose': 0.64; 'different': 0.65; '(that': 0.65; 'charset:windows-1252': 0.65; 'within': 0.65; 'here': 0.66; 'between': 0.67; 'yes': 0.68; 'subject:there': 0.68; 'limit': 0.70; 'present.': 0.74; 'cobol': 0.84; 'conclude': 0.84; 'different.': 0.84; 'pardon': 0.84; 'presumably': 0.84; 'received:195.238': 0.84; 'received:195.238.6': 0.84; 'received:belgacom.be': 0.84; 'received:isp.belgacom.be': 0.84; 'similars': 0.84; 'subject:being': 0.84; 'rusi': 0.91; 'same,': 0.91; 'differences': 0.93; '2013': 0.98 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApMBAKOIn1JQyGuj/2dsb2JhbAANTblwgwaBOoMZAQEBAwEyAUURCxgJFgQLCQMCAQIBRRMIAod4C7B2ikyGRBeOEhQBXoQzA5gUk36BP4FnAQg Date: Wed, 04 Dec 2013 20:57:11 +0100 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers? References: <15912943-29a1-4365-b027-7bb8cec447f8@googlegroups.com> <17gt99hg615jfm7bdid26185884d2pfdkf@4ax.com> <080d6a56-588b-425f-8968-8f77bc330427@googlegroups.com> <549180f1-fb98-4b59-b92f-5beceb1a6fb5@googlegroups.com> <68a2d20a-793f-4493-b856-c6c65617eb0d@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 68 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386187102 news.xs4all.nl 2931 [2001:888:2000:d::a6]:33154 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61043 Op 04-12-13 14:02, rusi schreef: > On Wednesday, December 4, 2013 6:02:18 PM UTC+5:30, Antoon Pardon wrote: >> Op 04-12-13 13:01, rusi schreef: >>> 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. >> >> No you don't need to change the lexical and grammatical structure of >> the language. Changing the characters allowed in identifiers, is not a >> change in lexical structure. The only difference in lexical structuring >> would be that '-', '>=' and other similars symbols would have to be >> treated like keyword like 'from', 'as' etc instead of being recognizable >> by just being present. > > Well I am mystified… > Consider the string a-b in a program text. > A Cobol or Lisp system sees this as one identifier. > Python, C (and most modern languages) see this ident, operator, ident. > > As I understand it this IS the lexical structure of the language and the lexer > is the part that implements this: > - in cobol/lisp keeping it as one > - in python/C breaking it into 3 > > Maybe you understand in some other way the phrase "lexical structure"? Yes I do. The fact that a certain string is lexically evaluated differently is IMO not enough to conclude the language has a different lexical structure. It only means that the values allowed within the structure are different. What I see here is that some languages have an other alphabet over which identifiers are allowed. >> And the grammatical structure of the language wouldn't change at all. >> Sure a-b would now be an identifier and not an operation but that is >> of no concern for the parser. > > About grammar maybe what you are saying will hold: presumably if the token-set > is the same, one could keep the same grammar, with the differences being > entirely inter-lexeme ones. And the question is. If the token-set is the same, how is then is the lexical structure different rather than just the possible values associate with the tokens? -- Antoon Pardon