Not found in the documentation

Peter J. Holzer hjp-python at hjp.at
Wed Apr 28 05:18:24 EDT 2021


On 2021-04-27 06:42:38 -0700, elas tica wrote:
> > The *Language Reference* is designed to be much more formally defined, and 
> > favors correctness and completeness over being easy to access by less 
> > technical readers. 
> > 
> 
> 
> Not really my opinion. Language Reference (LR) style is still written
> in a conversational style, giving examples instead of definition.

The style is certainly less formal that that of - for example - the C
standard. However, every text written in a natural language is to some
extent informal and open to interpretation. So the real question is: Is
the text unambiguous enough so that the intended target audience can
agree on the answer to any question? The fact that there exist several
Python implementations seems to support that, although I don't know how
compatible those actually are and the existence of a reference
implementation certainly helps.

Everything else is a matter of personal taste.


> By the way, how the docs define a container? Answer: "Some objects
> contain references to other objects; these are called containers". So
> to summarize : "a container contains", what a great definition!

That's why it's called a container. But it also says *what* an object
must contain to be called a container. You could say that an int object
contains an integer value and a str object contains a reference to a
buffer containing the string - but those aren't references to other
objects, so int and str are not containers.


> You said that LR is designed to be much more formally defined, and
> favors correctness and completeness. Good, so can you answer this
> question after reading the LR : what is a "token"? Did't find a
> definition.

There is an indirect definition right at the start of chapter 3: "Input
to the parser is a stream of tokens, generated by the lexical analyzer."
So a token is what the unit of output of the lexer. This is the
definition. The rest of the chapter defines the details. 

> Is the "is not" operator a token?

Yes. See chapter 2.3.1.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20210428/638e6f80/attachment.sig>


More information about the Python-list mailing list