[Python-ideas] Proposal: Query language extension to Python (PythonQL)

Paul Moore p.f.moore at gmail.com
Mon Mar 27 06:18:03 EDT 2017


On 27 March 2017 at 10:54, Brice PARENT <contact at brice.xyz> wrote:
> I get it, but it's more a matter of perception. To me, the version I
> described is just Python, while yours is Python + specific syntax. As this
> syntax is only used in PyQL sub-language, it's not really Python any more...

... which is why I suspect that this discussion would be better
expressed as a suggestion that Python provide better support for
domain specific languages like the one PythonQL offers. In that
context, the "extended comprehension" format *would* be Python,
specifically it would simply be a DSL embedded in Python using
Python's standard features for doing that. Of course, that's just a
re-framing of the perception, and the people who don't like
sub-languages will be just as uncomfortable with DSLs.

However, it does put this request into the context of DSL support,
which is something that many languages provide, to a greater or lesser
extent. For Python, Guido's traditionally been against allowing the
language to be mutable in the way that DSLs permit, so in the first
instance it's likely that the PythonQL proposal will face a lot of
resistance. It's possible that PythonQL could provide a use case that
shows the benefits of allowing DSLs to such an extent that Guido
changes his mind, but that's not yet proven (and it's not really
something that's been argued here yet). And it does change the
discussion from being about who prefers which syntax, to being about
where we want the language to go in terms of DSLs.

Personally, I quite like limited DSL support (things like allowing
no-parenthesis function calls can make it possible to write code that
uses functions as if they were keywords). But it does impose a burden
on people supporting the code because they have to understand the
non-standard syntax. So I'm happy with Python's current choice to not
go down that route, even though I do find it occasionally limiting.

If I needed PythonQL features, I'd personally find Brice's class-based
approach quite readable/acceptable. I find PythonQL form nice also,
but not enough of an advantage to warrant all the extra
keywords/syntax etc.

Paul


More information about the Python-ideas mailing list