A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-March/109293.html below:

[Python-Dev] pydoc for named tuples is missing methods

[Python-Dev] pydoc for named tuples is missing methodsNick Coghlan ncoghlan at gmail.com
Tue Mar 15 12:59:16 CET 2011
On Tue, Mar 15, 2011 at 6:20 PM, Eric Smith <eric at trueblade.com> wrote:
> The field names are not always under direct control of the developer, such
> as when they are database column names. Not that using _replace completely
> gets rid of this problem, but I agree with Raymond's decision that a field
> name can be any valid identifier not starting with an underscore. It's the
> simplest thing for the developer using namedtuple.

While I actually think the current API design is a decent compromise,
another option to consider would be to move the underscore to the
*end* (as_dict_, replace_, make_) as is sometimes done for code that
needs to avoid conflicting with a keyword.

Namespace collisions with actual fields would remain unlikely, while
pydoc would pick up the new names correctly.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4