|
|
Subscribe / Log in / New account

Re: Impact of Namedtuple on startup time

From:  Raymond Hettinger <raymond.hettinger-AT-gmail.com>
To:  Steve Holden <steve-AT-holdenweb.com>
Subject:  Re: Impact of Namedtuple on startup time
Date:  Mon, 17 Jul 2017 08:29:18 -0700
Message-ID:  <34A86EF5-8A12-40E7-881D-1E2C5FFE7B18@gmail.com>
Cc:  "Python-Dev-AT-Python. Org" <python-dev-AT-python.org>


> On Jul 17, 2017, at 8:22 AM, Steve Holden <steve@holdenweb.com> wrote:
> 
> My only question is "what's a variable called _source doing in the public API?"

The convention for named tuple hnas been for all the methods and attributes to be prefixed with an
underscore so that the names won't conflict with field names in the named tuple itself.  For
example, we want to allow Path=namedtuple('Path', ['source', 'destination']).

If I had it all to do over again, it might have been better to have had a different convention like
source_ with a trailing underscore, but that ship sailed long ago :-)


Raymond


to post comments


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds