On Sat, Nov 27, 2021 at 1:39 AM Raimi bin Karim <raimi.bka...@gmail.com> wrote:
> So this is more of a heartfelt note rather than an objective one — I would 
> love
> my fellow Python programmers to be exposed to this mental model, and that
> could only be done by implementing it in the standard library.

I'm not certain that being in the standard library exposes Python
programmers to something. Without looking up any references, which of
these can you do with just the Python standard library (shelling out
to external programs doesn't count)?

* Get the dimensions of your terminal window
* Connect to a PostgreSQL database
* Extract login information from an FTP URL
* Hash and verify passwords with bcrypt
* Build an SMTP server
* Build an FTP server
* Parse a WAV file
* Parse an MP3 file
* Change the value of 3
* Build an MSI file (Windows installer)
* Convert a file from UTF-7 to UTF-8
* Enumerate all Unicode characters that represent the digit 6

More importantly: If you didn't know that one of these was possible,
would spending time writing Python code have exposed you to it? For
instance (sorry, spoilers), the last one is most definitely possible,
but if you were parsing input, would you think to check for anything
other than the ASCII character '6'?

Once you've thought of something, it's easy to think "it'd be cool if
Python already had this". But the exact set of iteration tools that
*you* want is probably not the same as the set of iteration tools that
someone else wants. It would be extremely hard for the stdlib to have
the perfect set of tools available, and as soon as something isn't
available, you have to appeal to the core devs to add it, then wait
for a release of Python that includes it.

In contrast, you can simply use your own pipeline class without
synchronizing with anyone else. You can choose what to call it, what
tools to make available (and can add more as you find the need), and
can make your own decisions about style, like whether it should be
"pipe(x) | filter(...) | sort(...)" or "pipe(x).filter(...).sort(...)"
or even "pipe(x) @filter(...) @sort(...)". There's no need to convince
anyone else of what you think is right - you can just go ahead and do
it!

BTW, if you want more iteration tools, there are plenty to choose
from. The more-itertools library has a ton of really cool stuff.
Should they also be available in the pipeline? If you're making your
own, then absolutely yes, you can have them available. But if it's
part of the standard library, it can't depend on an external module
like that.

ChrisA
_______________________________________________
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/XISD5GPXNYXA6SVVYNW5GWHU5DSERSCC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to