> There's no such thing, though, any more than there's such a thing as a > "raw string". There are only two types of string in Python - text and > bytes. You can't behave differently based on whether you were given a > triple-quoted, raw, or other string literal.
A simple implementation could be something like: @register_literal_prefix("sql") class SqlLiteral(str): pass class Connection: ... def execute(self, stmt): if isinstance(stmt, SqlLiteral): # proceed as usual ... else: throw TypeError("Expected sql'' string") _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/6D2E2GFBGKELBZB23PMT4OMEDZIJWFJD/ Code of Conduct: http://python.org/psf/codeofconduct/