On Fri, 8 Apr 2022 at 10:15, Daniel Pope <lord.ma...@gmail.com> wrote:
> But, your proposed syntax is not usable because it is ambiguous. Exactly what 
> you propose is already used for decorators in a way that the parser would not 
> be able to distinguish a decorator from an import expression. Consider:
>
>     @ham.spam()   # import expression or decorator?
>
>      def eggs():
>         ...
>
> This currently parses as a decorator and for backwards compatibility that 
> must not change, which means that import expressions would be usable in some 
> contexts and not others purely based on what follows them.

Perhaps `some_regex = re::compile(r"...")` could work.

That is, <dotted-path>::<name-to-import> to delineate the import.

@breakfast.ham::spam
def eggs(): pass

Cheers
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/VXOSHFQDLPI5KXVNXWKFMRZOZHYJLZL5/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to