Curious about library inclusion

Antoon Pardon antoon.pardon at vub.be
Wed Oct 16 03:25:03 EDT 2019


On 15/10/19 13:59, Rhodri James wrote:
> On 15/10/2019 12:38, Antoon Pardon wrote:
>> On 11/10/19 15:48, Rhodri James wrote:
>>> On 10/10/2019 12:40, Antoon Pardon wrote:
>>>> About including piped iterators:
>>>>     
>>>> http://code.activestate.com/recipes/580625-collection-pipeline-in-python/
>>>>
>>>> On 10/10/19 13:00, Paul Moore wrote:
>>>>> As another measure, look at various other libraries on PyPI and ask
>>>>> yourself why *this* library needs to be in the stdlib more than those
>>>>> others. The answer to that question would be a good start for an
>>>>> argument to include the library.
>>>>
>>>> Well my answer would be that this library wouldn't add functionality
>>>> but rather would allow IMO for a more readable coding style.
>>>>
>>>> If you split the work to be done over mulitple generators I find it
>>>> easier to understand when I read something like:
>>>>
>>>>       for item in some_file | gen1 | gen2 | gen3:
>>>>           ...
>>>>
>>>> than when I read something like:
>>>>
>>>>       for item in gen3(gen2(gen1(somefile))):
>>>>           ...
>>>
>>> With my ever-so-reactionary hat on, I have to say I'm the other way
>>> round.  With "gen3(gen2(gen1(somefile)))" it's pretty obvious what's
>>> going on -- nested function or generator calls, probably the latter
>>> from the name.  With "somefile|gen1|gen2|gen3" I need more context to
>>> kick my expectations out of the more common meaning of "|" as "or".
>>>
>>> Yes, context demands that the "|" in your first example can't actually
>>> be an "or".  It still causes a moment of logical disconnect (currently
>>> a long moment) that throws me out of understanding what your code is
>>> doing overall into what this line means in particular.  It's exactly
>>> like coming across an unusual phrasing or iffy grammar in a piece of
>>> writing; you get thrown out of the reading experience by having to
>>> concentrate on the individual words.
>>
>> But isn't this just a matter of experience? For example does it still
>> causes a moment of logical disconnect when you see a '+' used for
>> concatenation? For me the use of '|' is very similar to how it is used
>> by unix shells. Would the use of an other operator ease this disconnect
>> for you, maybe '>>', or wouldn't that make a difference?
>
> I *could* get used to any syntax, but why should I?  We have syntax
> that works perfectly well already.  Making me go to the extra effort
> of importing shell-style pipes or C++-style streams into my mental
> construct of Python doesn't really seem necessary.

In light of Python's history, I find this a strange argument. A lot of
the features in current Python are inspired by things from other
languages and where not necessary. We had syntax and semantics that
worked perfectly well. That didn't stop anyone from introducing things
they thought could benefit the language.

But it seems that at this moment there is little enthusiasm for this
idea, so this was my final contribution in this thread.

-- 
Antoon.



More information about the Python-list mailing list