On Fri, Jan 21, 2022 at 08:36:37AM -0800, Christopher Barker wrote:
> On Fri, Jan 21, 2022 at 3:52 AM Oscar Benjamin <[email protected]>
> wrote:
> > I really don't understand (having read everything above) why anyone
> > prefers {1,2,3}.frozen() over f{1,2,3}.
> >
>
> Because it doesn't require any change to the language -- it's a feature,
> not a language change. Every change to the language is s substantial burden
> to the whole community. Even a "small" one like this.
The change from "" ASCII byte strings to Unicode was a substaintial
change that lead to a substantial burden on library developers, at least
in the short-term. Adding a new operator like `@` has been barely
noticed. Out of the two extremes, I don't think that adding f{} displays
would be closer to changing the meaning of strings than to adding the
matmul operator.
I do acknowledge that f{} would be perplexing to beginners who just saw
it written down with no explanation or context, but then the same
applies to slicing and list comprehensions.
> Python is not a high-performance language -- has it ever had a feature
> added primirly so it could be optimized? (that is a serious question).
Maybe we should stop dismissing performance as unimportant. Nobody has
ever said that Python is too fast.
I was going to joke that nobody has ever asked "How do I make Python
slower?", but sure enough somebody has:
https://stackoverflow.com/questions/16555120/how-can-i-slow-down-a-loop-in-python
*wink*
I acknowledge that this specific change would likely be a micro-
optimization, but looking beyond this proposal, perhaps we should start
considering adding features specifically for performance?
People are developing entire new Python interpreters and variants to
improve performance, and have done so for many years. There is an
impressive list of past and present such projects:
- Cython
- Nuitka
- Pyston
- Cinder
- wpython
- Hotpy
- Unladen Swallow
- Numba
- Pythran
among others. So maybe we should consider *not* saying "Python is fast
enough", or "Just re-write it in C", and consider language features that
are aimed specifically or mainly at performance.
Just a thought to mull over.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/CILW3LIGCPSHAPTDT2HWWV6CR236ZNSA/
Code of Conduct: http://python.org/psf/codeofconduct/