On 25 April 2015 at 17:58, Larry Hastings <la...@hastings.org> wrote: > > On 04/24/2015 09:45 PM, Nick Coghlan wrote: > > Ah, I misread Tal's suggestion. Using unary + is an even neater approach. > > > Not exactly. The way I figure it, the best way to achieve this with unary > plus is to ast.parse it (as we currently do) and then modify the parse tree. > That works but it's kind of messy. > > My main objection to this notation is that that set objects don't support +. > The union operator for sets is |.
Good point. > I've prototyped a hack allowing > str(accept|={NoneType}) > I used the tokenize module to tokenize, modify, and untokenize the converter > invocation. Works fine. And since augmented assignment is (otherwise) > illegal in expressions, it's totally unambiguous. I think if we do it at > all it should be with that notation. I'd say start without it, but if it gets annoying, then we have this in our back pocket as a potential fix. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com