[Python-ideas] Custom string prefixes

Andrew Barnert abarnert at yahoo.com
Thu May 30 03:55:50 CEST 2013


On May 27, 2013, at 23:32, Ron Adam <ron3200 at gmail.com> wrote:

> Moving them to the run time parser would make some things slower.  Being able to add or register more prefix's would probably hurt Pythons readability when you want to review someone else's programs.  I think it would only improve readability for programs we write ourselves, because then we know much more easily what we defined those prefixes to mean.  That wouldn't be the case when we read someone else's code.

If there's a use case with wide applicability within a particular domain, I could see a prefix being nonstandard, but still a de facto standard within that domain, and therefore increasing readability.

As a rough parallel, consider that numpy arrays don't quite implement the normal Sequence protocol, and have all kinds of behaviors that are nonsense for normal sequences, and yet indexing with tuples and ellipses doesn't cause any readability problems for numeric programmers--and in fact python 3.0 even added a small change to make it easier for them.

The question is whether there's any comparable use case here. Is there some prefix that would be widely useful in numerics or django or XML processing or whatever? Or would prefixes only really be useful for local ad hoc domains?


More information about the Python-ideas mailing list