How to modify this from Python 2.x to v3.4?

jfong at ms4.hinet.net jfong at ms4.hinet.net
Sat Nov 11 21:06:52 EST 2017


Ned Batchelder於 2017年11月11日星期六 UTC+8下午8時49分27秒寫道:
> This looks like fairly advanced code.  It will be difficult to port to 
> Python 3 *without* understanding some of the old history.  There seem to 
> be forks on GitHub, including one with a pull request about Python 3 
> made in the last few days: 
> https://github.com/davidjamesca/ctypesgen/pull/58 .  I'd recommend 
> working with others on this.

Thank you, Ned.

As I remember that I had opened a thread here last year, trying to use "2To3" tool to convert the ctypesgen package, but didn't success.
https://groups.google.com/forum/#!topic/comp.lang.python/9G0FJXmtwbA

This time, somehow I find this "ctypesgen-python-3" package and can't wait to give it a try, but is disappointed again. I suppose there are many v3.x users who like to use ctypesgen to ease the using of ctypes. But obviously, it's not an easy work to do, convert 2 to 3:-)

By the way, does anyone know what the following codes does? (in printer.py file) and how to convert it to v3.x?

class WrapperPrinter:
    def __init__(self,outpath,options,data):
        ...
        ...
        self.print_header()
        print >>self.file
        
        self.print_preamble()
        print >>self.file

        self.print_loader()
        print >>self.file
        ...
        ...

--Jach




More information about the Python-list mailing list