On Mon, Feb 14, 2011 at 11:23:10AM +0100, Daniel Fetchinson wrote:
> > classnr = 0
> >
> > class Base(object):
> > __metaclass__ = declarative.DeclarativeMeta
> > def __classinit__(cls, newattrs):
> > log.debug("%s.__classinit__" % cls)
> > global classnr
> > classnr = classnr + 1
>
> Sounds good, thanks! There is no global locking issue we need to worry
> about, right? I mean there is this global variable classnr.....
Of course there is. But if you look into the current code, it uses
itertools.count() which, I believe, is thread-safe.
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|