generator/coroutine terminology

Marko Rauhamaa marko at pacujo.net
Sat Mar 14 04:30:30 EDT 2015


Mark Lawrence <breamoreboy at yahoo.co.uk>:

> On 14/03/2015 07:54, Marko Rauhamaa wrote:
>> I am an actual Python programmer (I develop Python programs) and my
>> definitive source for Python is the documentation. If there is an
>> error in the documentation, I would very much like it to be
>> corrected.
>
> Five minutes work for you (singular) on the bug tracker.

I haven't determined that there is an error. I couldn't because to me,
the documentation defines right and wrong.

The only sign of discord so far has been between the return value of
str() and the language of the documentation. The return values of str()
and repr() are not defined very precisely:

 object.__repr__(self)
    Called by the repr() built-in function to compute the “official”
    string representation of an object. If at all possible, this should
    look like a valid Python expression that could be used to recreate
    an object with the same value (given an appropriate environment). If
    this is not possible, a string of the form <...some useful
    description...> should be returned. The return value must be a
    string object. [...]

 object.__str__(self)
    Called by str(object) and the built-in functions format() and
    print() to compute the “informal” or nicely printable string
    representation of an object. The return value must be a string
    object.

Thus one shouldn't read too much into what str() and repr() return. In
particular, there is no requirement that two valid Python
implementations ought to return similar-looking strings.


Marko



More information about the Python-list mailing list