Users of namedtuple: do you use the _source attribute?
Steve D'Aprano
steve+python at pearwood.info
Tue Jul 18 23:12:00 EDT 2017
On Wed, 19 Jul 2017 08:39 am, Gregory Ewing wrote:
> Steve D'Aprano wrote:
>> "source_" is already a public name, which means that users could want to
>> create fields with that name for some reason,
>
> They could equally well want to define their own private
> field called "_source".
Um... well, people want to do all sorts of wild and wacky things... but why
would you define a named tuple with *private* fields? Especially since that
privateness isn't enforced when you access the items by position.
In any case, the namedtuple API prohibits that, so it isn't an option.
--
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
More information about the Python-list
mailing list