[docs] Section 5 of Python 2.7.16 documentation errors
Julien Palard
julien at palard.fr
Mon Mar 11 17:49:39 EDT 2019
Hi Bud!
Thanks for taking the time to report issues, it's appreciated!
> Most notable, section 5. Expressions
>
> def f(a,b):
>
> print a,b # raises an error and should read print(a,b)
Your mail subject indicates you found those errors in the Python 2.7 documentation, but it looks like you're trying with a Python 3.
print a, b is a Python 2 syntax, and print(a, b) is a Python 3 syntax, there's a whole lot of changes that happened between Python 2 and Python 3 ten years ago, you probably want to focus on Python 3 noadays, while reading the Python 3 documentation.
> Section 5.4 Raising a negative number to a fractional power does not
> return an error as stated in the documentation but appears to
> functioning correctly.
Again, you may have tried with a Python 3:
# Python 2.7.16
>>> (-1) ** .5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power
# Python 3.7.2
>>> (-1) ** .5
(6.123233995736766e-17+1j)
> Section 5.9 <> returns a syntax error and is no longer usable to replace !=
# Python 2.7.16
>>> 1 <> 2
True
# Python 3.7.2
>>> 1 <> 2
File "<stdin>", line 1
1 <> 2
^
SyntaxError: invalid syntax
Bests,
--
Julien Palard
https://mdk.fr
More information about the docs
mailing list