Users of namedtuple: do you use the _source attribute?

Steve D'Aprano steve+python at pearwood.info
Mon Jul 17 21:24:00 EDT 2017


On 2017年7月18日 05:44 am, Rob Gaddi wrote:
> That said, it sure feels (as someone who hasn't tried it) like there's a
> straightforward namedtuple implementation that calls type() directly
> rather than having to exec. I know that exec-gunshyness is overblown,
> but is there a simple answer as to why it's necessary here?

It's very hard to write __new__ with a sensible parameter list without exec.
-- 
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

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