Author tjollans
Recipients georg.brandl, tjollans
Date 2010-06-07.18:55:59
SpamBayes Score 6.15989e-05
Marked as misclassified No
Message-id <>
aifc getcomptype() and setcomptype() use bytes while the corresponding methods in the sunau and wave modules use str (b'NONE', b'ULAW' vs 'NONE', 'ULAW'). This means that programmers wanting simple format-agnostic audio file output will have to special-case aifc. This was not necessary in Python 2.x, where all three modules used str (obviously). IMHO, there is no reason for this incompatibility.

The solution I propose is to change aifc to use unicode str for "information" strings and bytes for raw data only, like the other two modules. This is, the way I see it, the most sensible behaviour.

I'm attaching a patch that does just this: it changes aifc to use str for all (non-data) strings: comptype, compname, and markers. I've also changed the testcase accordingly.

The problem is, obviously, that this could break existing code. I doubt that it would break a lot of code since:
 - not that many people use aifc anyway (I think), and py3k is still
 - py3k code that's out there now would most likely handle both
   scenarios anyway to account for the wave and sunau modules
 - setcomptype() would still accept bytes.

On the other hand, it would, as I said, simplify writing format-agnostic code. Special-casing any module wouldn't have been necessary with Python 2, why should Python 3 be any different?

There, I've made my case. Georg, I put you on the nosy list because of
  [svn r64023] Remove cl usage from aifc and use bytes throughout.
You, apparently, made the decision I'm arguing should be reverted, if indeed anyone consciously made it at all.

If this is applied, it would have to be properly documented, of course.
Date User Action Args
2010-06-07 18:56:05tjollanssetrecipients: + tjollans, georg.brandl
2010-06-07 18:56:05tjollanssetmessageid: <>
2010-06-07 18:56:04tjollanslinkissue8934 messages
2010-06-07 18:56:01tjollanscreate