Paul Moore <[EMAIL PROTECTED]> writes: > OK, but that allocates the initial buffer, which I will then throw > away.
Why don't you use a constructor argument that allows specifying the initial buffer size? > In practice, this isn't a significant issue (the overhead of one > allocation and one deallocation isn't going to wreck things!) but it > feels somehow clumsy. However, I can't see an obvious way to > refactor the code so that building the object and assigning the > buffer are separate - so that I can write a function like > Pattern_init, which allocates a differently sized buffer (well, I > could, but if I did, I'd have no way of using it that respects > subclassing... Another way would be to avoid allocating the buffer at all until it is actually needed. -- http://mail.python.org/mailman/listinfo/python-list