> Unless there is some significant difference between the two, what does 
> this proposal give us?

The difference between `x'...'` and `x('...')`, other than visual noise, is the
following:

- The first "x" is in its own namespace of string prefixes. The second "x"
  exists in the global namespace of all other symbols.

- Python style discourages too short variable names, especially in libraries,
  because they have increased chance of clashing with other symbols, and
  generally may be hard to understand. At the same time, short names for
  string prefixes could be perfectly fine: there won't be too many of them
  anyways. The standard prefixes "b", "r", "u", "f" are all short, and nobody
  gets confused about them.

- Barrier of entry. Today you can write `from re import compile as x` and then
  write `x('...')` to denote a regular expression (if you don't mind having `x` 
as
  a global variable). But this is not the way people usually write code. People
  write the code the way they are taught from examples, and the examples 
  don't speak about regular expression objects. The examples only show
  regular expressions-as-strings, so many python users don't even realize
  that regular expressions can be objects.

  Now, if the string prefixes were available, library authors would think "Do we
  want to export such functionality for the benefit of our users?" And if they
  answer yes, then they'll showcase this in the documentation and examples,
  and the user will see that their code has become cleaner and more 
  understandable.
_______________________________________________
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/YYN7DVRINV7HGZ5ENVFBBERB2LY2SCM7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to