Re: [code] Textadept in the migration from Python2 to Python3

From: Pedro Andres Aranda Gutierrez <paaguti.att.gmail.com>
Date: Fri, 22 Apr 2016 09:13:50 +0200

Hi,

I'm not saying that we change TextAdept to work with Python3 only. However,
you will agree that this will be an issue in the future as more people
start migrating. I would suggest that if a solution to this issue is found
that makes TextAdept work with both Python2 and Python3, it is integrated
into the release (i.e. not in the user's init.lua). This will make the case
for textAdept only stronger :-)

/PA

On 21 April 2016 at 18:19, Arnel <rcl.att.openmailbox.org> wrote:

> On 21 April 2016 03:59PM, Pedro Andres Aranda Gutierrez wrote:
> > Hi folks,
> >
> > I'm starting to migrate from Python2 to Python3. No problems in Python2,
> > but since the default program bindings are for Python2, I get tons of
> false
> > warnings and errors.
> > I'm currently marking migrated Python3 scripts with the following
> shebang:
> >
> > #!/usr/bin/env python3
> >
> > Is there any way to take this into account. At least to avoid false
> > positives when saving files...
> >
> > Best, /PA
>
> To identify Python3 scripts, you could add these to your 'init.lua':
>
> textadept.file_types.patterns['^#!.+[/ ]python3'] = 'python3'
>
> textadept.run.syntax_commands.python3 = function()
> return ([[python3 -c
> "compile(open('%f').read(),'%f','exec',0,1)"]]):gsub('%%f',
> (buffer.filename:gsub('\\', '\\\\\\\\'))) end
>
> textadept.run.run_commands.python3 = 'python3 -u "%f"'
>
> (You may need to adjust the indentation.)
>
> That covers the syntax-checking and "run" commands for Python 3, at least.
>
> However, if we change the default file extensions like so:
>
> textadept.file_types.extensions.py = 'python3'
>
> TA would read that as "all files ending in '.py' are Python3." Your Python2
> scripts won't get identified as Python2 scripts.
>
> ----
> Thank you,
> Arnel
> --
> You are subscribed to code.att.foicica.com.
> To change subscription settings, send an e-mail to code+help.att.foicica.com.
> To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
>
>

-- 
Fragen sind nicht da um beantwortet zu werden,
Fragen sind da um gestellet zu werden
Gerog Kreisler
-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 22 Apr 2016 - 03:13:50 EDT

This archive was generated by hypermail 2.2.0 : Fri 22 Apr 2016 - 06:52:27 EDT