On Wed, Sep 16, 2009 at 10:41 AM, Iustin Pop <[email protected]> wrote: > On Wed, Sep 16, 2009 at 10:34:01AM +0100, Guido Trotter wrote: >> On Wed, Sep 16, 2009 at 10:17 AM, Iustin Pop <[email protected]> wrote: >> > >> > Uh uh uh "4" "4" "4". Please don't use this. Please say plen = >> > lentgth(constants.CONFD_MAGIC_FOURCC) and use that in all places. >> > >> >> Oh, ok, I had asked hansmi whether I should have created a constant >> for the 4cc len, and he said to just use 4... >> But I can create one, then! BTW in the unittests we're checking that >> it stays 4 (as changing it would anyway break retrocompatibility in >> the protocol) > > Ah, I'm not saying a constants, I'm just saying in this function, have a > local variable that is computed using len, so if we change this, you > don't have to change this function, only the string in constants.py.
Well, I use it in both functions so maybe a module constant would be better? It doesn't make sense to calculate it each time we call the function, and it's very harmful to change the lentght (because then "old" packages get broken. And a fourcc is defined as four characters, so we'd need to change the name and the unittests as well). How about _FOURCC_LEN = 4 in confd/__init__.py ? Guido
