[Python-Dev] pydoc for named tuples is missing methods
Eric Smith
eric at trueblade.com
Tue Mar 15 09:20:27 CET 2011
More information about the Python-Dev mailing list
Tue Mar 15 09:20:27 CET 2011
- Previous message: [Python-Dev] pydoc for named tuples is missing methods
- Next message: [Python-Dev] pydoc for named tuples is missing methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 03/14/2011 10:02 PM, James Mills wrote: > On Tue, Mar 15, 2011 at 11:50 AM, Terry Reedy<tjreedy at udel.edu> wrote: >>> How would that work if you had a field named "replace"? I think >>> Raymond's current design is as good as it's going to get. >> >> 'as_dict' is an unlikely fieldname. 're_place' is too, but that just shift >> the '_' from '_replace'. No gain. I might prefer _asdict to _as_dict, but >> not enough to change. > > Probably a stupid idea (sorry) but one could just > make asdict() and replace() public methods > with the caveat that developers not use those > as field names. 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. Eric.
- Previous message: [Python-Dev] pydoc for named tuples is missing methods
- Next message: [Python-Dev] pydoc for named tuples is missing methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list