Re: Reading the documentation

2017-08-26 Thread Tim Golden

On 26/08/2017 03:22, Rick Johnson wrote:

Steve D'Aprano wrote:

Rustom Mody wrote:

Ian wrote:

"Larry Martell"  wrote:
9:21 PM Rustom Mody wrote:

Statement 1: Aeroplanes fly. Statement 2: Submarines swim.
Are these two statements equally acceptable?  [Inspired
by a talk by Noam Chomsky]

There should be a corollary of Godwin's law for that
idiot.

[...]

[Larry seems to be angry about/at somethin'… No idea who/what…]


Chomsky challenges the prevailing world-view that the USA
is a force for good, by documenting the many, many, many
ways that the USA's actions are harmful, unjust, illegal
(occasionally all three at once) and in contradiction to
the nation's stated values. Many people don't like it when
you challenge their cherished myths.


Nor when you glorify their most hated enemy.


[... snip ...]

Unusually, I'd like to speak as one of the list owners and ask people to 
continue this thread of conversation elsewhere. We're quite tolerant to 
fairly off-topic side-threads here, but I think this one is going to 
generate more heat than light and it's not even tangentially on-topic.


So please feel free to have a private correspondence or to set 
follow-ups to some political debating group. But let it drop on this list.


Thanks

TJG
--
https://mail.python.org/mailman/listinfo/python-list


Re: Protocols in Python

2017-08-26 Thread Ian Kelly
On Sat, Aug 26, 2017 at 6:35 PM, Stefan Ram  wrote:
>   The "The Python Library Reference, Release 3.6.0" (LIB) says:
>
>   »it must support the sequence protocol (the
>   __getitem__() method with integer arguments
>   starting at 0).«.
>
>   But in the "The Python Language Reference, Release 3.6.0"
>   (LANG) this is called »old sequence iteration« or »old-style
>   iteration« with the (new) sequence protocol being augmented
>   by »__len__«.

I think you're confused. There is no "new" sequence protocol. The
sequence protocol is just the set of special methods that one might
use to implement a sequence. There have been methods added over time
(e.g. __reversed__ was added in 2.6) but there has been no major
overhaul as is suggested by the word "new".

Where the sequence protocol is sometimes contrasted is with the
iterator protocol in the context of iteration. Prior to PEP 234, only
sequences could be iterated over because at the time iteration was
implemented using the sequence protocol, specifically the __getitem__
method. PEP 234 added a new way to iterate using the iterator protocol
but left the sequence protocol itself unchanged. Hence, iteration
using the sequence protocol is "old", and iteration using the iterator
protocol is "new".

>   Then, LANG mentions a »find_spec() protocol« and one can only
>   /guess/ that this is what is being described in »5.3.4 The
>   meta path«, because there it does not say "this is now the
>   definition of the find_spec() protocol here".

That wording could stand to be tightened up. Muddying the waters
further, 5.5.2 describes the "path entry finder protocol" which
involves implementing a *different* find_spec method.
-- 
https://mail.python.org/mailman/listinfo/python-list