[Python-3000] About "daemon" in threading module

Nick Coghlan ncoghlan at gmail.com
Mon Sep 8 13:25:11 CEST 2008


Anand Balachandran Pillai wrote:
> I guess adding __slots__ to Thread class is the best approach
> for this. +1 for that...
> 
> IMHO, this is perhaps late for 3.0, but definitely a good thing
> to add for 3.1.

I'd want at least one major release with a deprecation warning on
Thread's __setattr__ before we did anything like blocking the addition
of new attributes. Thread has been exposed as a normal python class for
a long time, and there is sure to be code out there that relies on
setting new attributes on Thread instances.

And I still don't know what makes daemon so special that it needs typo
protection when almost everything else in the standard library doesn't
have it. Given the amount of memory that is going to be allocated for
the new thread's stack, the saving of the space for an empty __dict__
slot also isn't a particularly significant gain.

(I deliberately pronounce daemon as day-mon though, so I don't forget
how to spell it - perhaps pronouncing it as dee-mon makes it harder to
remember the order of the 'a' and the 'e'?)

If it is just the specific typo as 'deamon' that concerns people, adding
a property specifically to raise an exception for that name would be far
less hassle than locking down the attributes of all Thread instances.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
            http://www.boredomandlaziness.org


More information about the Python-3000 mailing list