Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2a206b

Browse files
committed
Mention math.degrees() and math.radians()
Other minor rewrites
1 parent cacfc07 commit a2a206b

1 file changed

Lines changed: 24 additions & 12 deletions

File tree

Doc/whatsnew/whatsnew23.tex

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,14 +293,13 @@ \section{PEP 285: The \class{bool} Type\label{section-bool}}
293293
clearly a truth value.
294294

295295
Python's Booleans were not added for the sake of strict type-checking.
296-
A very strict language such as Pascal
297-
% XXX is Pascal the right example here?
298-
would also prevent you performing arithmetic with Booleans, and would
299-
require that the expression in an \keyword{if} statement always
300-
evaluate to a Boolean. Python is not this strict, and it never will
301-
be. (\pep{285} explicitly says this.) So you can still use any
302-
expression in an \keyword{if}, even ones that evaluate to a list or
303-
tuple or some random object, and the Boolean type is a subclass of the
296+
A very strict language such as Pascal would also prevent you
297+
performing arithmetic with Booleans, and would require that the
298+
expression in an \keyword{if} statement always evaluate to a Boolean.
299+
Python is not this strict, and it never will be. (\pep{285}
300+
explicitly says so.) So you can still use any expression in an
301+
\keyword{if}, even ones that evaluate to a list or tuple or some
302+
random object, and the Boolean type is a subclass of the
304303
\class{int} class, so arithmetic using a Boolean still works.
305304

306305
\begin{verbatim}
@@ -382,14 +381,20 @@ \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}}
382381
Memory allocated with one API must not be freed with the other API.
383382

384383
\begin{itemize}
385-
\item To allocate and free an undistinguished chunk of memory, use
386-
\cfunction{PyMem_Malloc()}, \cfunction{PyMem_Realloc()},
387-
\cfunction{PyMem_Free()}, and the other \cfunction{PyMem_*}
388-
functions.
384+
\item To allocate and free an undistinguished chunk of memory using
385+
Python's allocator, use
386+
\cfunction{PyMem_Malloc()}, \cfunction{PyMem_Realloc()}, and
387+
\cfunction{PyMem_Free()}.
388+
389+
\item In rare cases you may want to avoid using Python's allocator
390+
in order to allocate a chunk of memory;
391+
use \cfunction{PyObject_Malloc}, \cfunction{PyObject_Realloc},
392+
and \cfunction{PyObject_Free}.
389393

390394
\item To allocate and free Python objects,
391395
use \cfunction{PyObject_New()}, \cfunction{PyObject_NewVar()}, and
392396
\cfunction{PyObject_Del()}.
397+
393398
\end{itemize}
394399

395400
Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides
@@ -492,6 +497,13 @@ \section{New and Improved Modules}
492497
>>>
493498
\end{verbatim}
494499

500+
\item Two new functions in the \module{math} module,
501+
\function{degrees(\var{rads})} and \function{radians(\var{degs})},
502+
convert between radians and degrees. Other functions in the
503+
\module{math} module such as
504+
\function{math.sin()} and \function{math.cos()} have always required
505+
input values measured in radians. (Contributed by Raymond Hettinger.)
506+
495507
\item Two new functions, \function{killpg()} and \function{mknod()},
496508
were added to the \module{posix} module that underlies the \module{os}
497509
module.

0 commit comments

Comments
 (0)