python 2 to 3 converter

Rob Gaddi rgaddi at highlandtechnology.invalid
Mon Dec 9 13:20:07 EST 2019


On 12/9/19 9:55 AM, songbird wrote:
> jfong at ms4.hinet.net wrote:
> ...
>> Even string is hard to be handled by the AI:-)
>>
>> Quoted from https://portingguide.readthedocs.io/en/latest/strings.html
>> " ... This means that you need to go through the entire codebase, and decide which value is what type. Unfortunately, this process generally cannot be automated."
> 
>    i don't agree.  if the language is already parsed then
> you have the strings.  the contents of the strings will
> have to be finite if they are fixed strings.  so to convert
> a fixed string you can choose a type for the value and run
> a test to see if it works.  if it does then you've picked
> the correct type, if it doesn't you pick the next type.
> there are only a finite number of types.
> 

And how exactly do you propose to determine whether the constant I've enclosed 
in quotation marks in Python2 represents "text" or "binary data"?  Not all text 
is words; think of SQL queries.  And some words are binary data, think SCPI 
commands being sent to a serial port.



More information about the Python-list mailing list