Assigning to None (was Re: Question about Python)
Steven D'Aprano
steve at REMOVETHIScyber.com.au
Sat Jul 2 21:47:07 EDT 2005
On Fri, 01 Jul 2005 12:59:20 -0400, François Pinard wrote:
> [Peter Hansen]
>> Mike Meyer wrote:
>> > Yes. I once grabbed an old program that did assignments to None. But
>> > that's always been a bad idea.
>
>> What was the use case!?
>
> People used to assign None to itself as a keyword argument in function
> headers. The goal was to make a local copy of the reference, which was
> then accessed faster than the global thing.
Can you say "premature optimization is the root of all evil"?
I'd like to see the profiling that demonstrated that this made a
significant -- or even measurable -- speed-up in anything but the most
unusual cases.
--
Steven
More information about the Python-list
mailing list