Users of namedtuple: do you use the _source attribute?

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Jul 18 18:39:18 EDT 2017


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".
IMO a better thing to do would have been to name
it "__source__". Dunder names are officially reserved
for use by the language or stdlib.
-- 
Greg


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /