'file' is not a built-in for Python 3

Bug #1454858 reported by Barry Warsaw
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mode.el
Fix Released
Medium
Andreas Roehler

Bug Description

'file' is not a built-in for Python 3 so it shouldn't get py-builtins-face applied to it in that case.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

While looking for this: we may select a shell for execution, but not switch buffer-mode. What about having a M-x python-mode2 RET, resp. M-x python-mode3 ?

BTW don't receive bug-mail from lp any more. Last received from April 26th.

Changed in python-mode:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Andreas Roehler (a-roehler)
milestone: none → 6.2.1
Revision history for this message
Barry Warsaw (barry) wrote : Re: [Bug 1454858] Re: 'file' is not a built-in for Python 3

On May 14, 2015, at 06:02 AM, Andreas Roehler wrote:

>While looking for this: we may select a shell for execution, but not
>switch buffer-mode. What about having a M-x python-mode2 RET, resp. M-x
>python-mode3 ?

A buffer might need to know whether it's Python 2 or 3, but I'm not sure a
different -mode is the way to do that. Maybe just a variable. I would
default that to python3 personally.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

If a variable exists, how it will be set? If set by default, what happens if a impcompatible piece of code shows up?

How to know about the setting of such a var?

There more I'm reflecting this, being inclined to indicate the buffer mode. By "Py3" or "Py2" for example.
Than having a python2-mode, resp. python3-mode by default.

Smart detection could switch the mode.

Cheers,

Andreas

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Made it detecting the Python version so far. However, as python-mode and its python-mode-map is loaded once only, it will DTRT WRT to first version loaded. If kind Python 3 settings are loaded, Python 2 buffer wont cause a reload.

Revision history for this message
Andreas Roehler (a-roehler) wrote :

Customizing new var py-python-edit-version to python3 should solve it so far. If left empty, edit-version is guessed by py-choose-shell.

Changed in python-mode:
status: In Progress → Fix Committed
Revision history for this message
Barry Warsaw (barry) wrote :

On May 18, 2015, at 11:35 AM, Andreas Roehler wrote:

>Customizing new var py-python-edit-version to python3 should solve it so
>far. If left empty, edit-version is guessed by py-choose-shell.

That seems like a nice solution. I definitely prefer the auto-guessing if it
works out, but OTOH, almost everything I do today is Python 3 anyway. :)

I'll update to the latest bzr head and let you know how it goes.

Changed in python-mode:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.