[Python-Dev] "Micro-optimisations can speed up CPython"

Guido van Rossum guido at python.org
Tue May 30 17:18:34 EDT 2017


On Tue, May 30, 2017 at 11:49 AM, David Wilson <dw+python-dev at hmmz.org>
wrote:

> On Tue, May 30, 2017 at 09:38:55PM +0300, Serhiy Storchaka wrote:
>
> > > In early ages of C structures didn't create namespaces, and member
> > > names were globals.
>
> > >That's nonsense. The reason is greppability.
>
> > Good reason!
>
> The first time I heard about prefixing struct members was to allow
> tricks like this:
>
>     x86_64-linux-gnu/bits/stat.h
>     94:# define st_atime st_atim.tv_sec     /* Backward compatibility.  */
>     95:# define st_mtime st_mtim.tv_sec
>     96:# define st_ctime st_ctim.tv_sec
>
> Which is relatively safe thanks to the prefix.
>

Believe me that is not why the prefix convention was introduced.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20170530/45aee90a/attachment.html>


More information about the Python-Dev mailing list