On 11 October 2013 07:11, Pavel Zlatovratsky
<
pavelzla...@gmail.com> wrote:
>>
>> Can you describe what you're trying to achieve and why you think
>> separating png.py into separate files helps with that?
>
> Realy I think there are many things that will be good with switch from
> single-file module into package.
> Exempli gratia:
> 1) Usage of iccp.py code. (it can be copied in png.py, but...)
Most of the iccp.py code does not belong in a PNG package.
> 2) separate different part of code into different files. Like separate file
> for pngsuite, may be unittests.. filters too of cource, may be some code for
> manipulation with alpha as separate module etc.
The unittests are going to go in a separate file.
PngSuite is only copied into png.py for testing; it will be moved to a
separate file.
The filters will not be moved into a separate file.
> 4K lines is very big module IMHO, compare to standard library where most
> modules are less than 2k lines or png plugin of PIL/Pillow (latest in git is
> 668 lines)
png.py is a big file. That is true.
But if you're going to criticise that, then merely comparing it to
files in the standard library is not going to help. You have to argue
that there is some benefit to splitting it into smaller files! Note
that I already said the tests and PngSuite are going, so it will be
smaller anyway.
Ah. I think this is what I wanted you to say much much earlier.
You're trying to compile with Cython, and you want Cython to use
exactly the same code.
I like that as a goal. A lot.
I'm just not interested in Cython.
> So there are three ways:
[...cut...]
> 3) My last hope. pngfilters.py pulled, 'unimported' from png.py.
> (part in png.py) => pngfilters.py => pngfilters.c
> This one I work on right now.
> This is much harder to implement, seems I have to change some conceptions
> about filters (but this also can improve speed more).
This approach seems best to me. I'm not really sure what you mean by
"change some conceptions about filters", but I'm sure the code will
show me.
Why can't Cython just compile the whole of png.py? Why compile just the filters?
Cheers,
drj