> > !for boo in foo: !if boo is !None:
!print(hoo) !else: !return !sorted(woo) I feel most people could not bear such a difficult syntax. Why have I to type so much '!'s ? On Thu, Jul 22, 2010 at 10:04 PM, Bartosz Tarnowski < bartosz-tarnow...@zlotniki.pl> wrote: > > Hello, guys. > > Python has more and more reserved words over time. It becomes quite > annoying, since you can not use variables and attributes of such names. > Suppose I want to make an XML parser that reads a document and returns an > object with attributes corresponding to XML element attributes: > > > elem = parse_xml("<element param='boo'/>") > > print elem.param > boo > > What should I do then, when the attribute is a reserver word? I could use > trailing underscore, but this is quite ugly and introduces ambiguity. > > > elem = parse_xml("<element for='each'/>") > > print elem.for_ #????? > > elem = parse_xml("<element for_='each'/>") > > print elem.for__ #????? > > My proposal: let's make a syntax change. > > Let all reserved words be preceded with some symbol, i.e. "!" (exclamation > mark). This goes also for standard library global identifiers. > > !for boo in foo: > !if boo is !None: > !print(hoo) > !else: > !return !sorted(woo) > > > This would allow the user to declare any identifier with any name: > > for = with(return) + try > > What do you think of it? It is a major change, but I think Python needs it. > > -- > haael > > _______________________________________________ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/ysj.ray%2Bpython-dev%40gmail.com > -- Ray Allen Best wishes!
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com